- (IBAction)touchAction:(id)sender {
LAContext *authen = [[LAContext alloc]init];
//判断当前设备是否支持touch id
BOOL isTouchIDAvailable = [authen canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL];
if (isTouchIDAvailable) {
NSLog(@"支持");
// 验证指纹
[authen evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"指纹登陆" reply:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSLog(@"登陆成功");
} else {
NSLog(@"登陆失败");
}
}];
} else {
NSLog(@"不支持");
}
}