ios 指纹识别功能

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(@"没有指纹识别功能");

}

}

你可能感兴趣的:(ios 指纹识别功能)