指纹识别

指纹识别

1.  // 创建一个本地认证的上下文对象
2. LAContext *ctx = [[LAContext alloc] init];
3.
4. // 检测设备是否支持指纹识别
5. if ([ctx canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]) {
6. [ctx evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"请扫描指纹" reply:^(BOOL success, NSError *error) {
7. if (success) {
8. // 指纹识别成功
9. [self showAlert:@"OK"];
10. }
11. else {
12. // 指纹识别失败
13. [self showAlert:@"Egg"];
14. }
15. }];
16. }
17. else {
18. // 设备不支持指纹识别
19. //[self showAlert:@"Big Egg"];
20. }
21.
 
原文地址:https://www.cnblogs.com/buakaw/p/5211397.html