ios 指纹识别功能

2016-07-22  本文已影响17人  孟维学

1.引入#import

2.- (IBAction)zhiwen:(id)sender {

LAContext *myContext = [[LAContext alloc] init];

NSError *authError = nil;

NSString *myLocalizedReasonString = @"请输入指纹";

if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {

[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics

localizedReason:myLocalizedReasonString

reply:^(BOOL success, NSError *error) {

if (success) {

NSLog(@"dd");

UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提醒" message:@"登录成功" delegate:self cancelButtonTitle:nil otherButtonTitles:@"ok", nil];

[alert show];

} else {

NSLog(@"ddddddddddd");

UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提醒" message:@"不是你" delegate:self cancelButtonTitle:nil otherButtonTitles:@"ok", nil];

[alert show];

}

}];

} else {

NSLog(@"没有指纹识别功能");

}

}

上一篇 下一篇

猜你喜欢

热点阅读