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