实现iOS的指纹识别需要先
#import <LocalAuthentication/LocalAuthentication.h>
LAContext *la =[[LAContext alloc] init];
BOOL issupport = [la canEvaluatePolicy:kLAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL];
la.localizedFallbackTitle = @"enter password"; // 验证失败后备选提示
if (issupport) {
[la evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"give me five" reply:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSLog(@"验证指纹成功");
}else
{
NSLog(@"验证指纹失败error= %@ ",[error localizedDescription]);
if (error.code == kLAErrorUserFallback) {
NSLog(@"需要输入密码"); // 可以自己设置密码比对
}
}
}];
}