iOS指纹识别
来源:互联网 发布:tcp ip网络协议分析 编辑:程序博客网 时间:2024/04/30 11:19
iOS指纹识别比较简单,主要由LAContontext类中的两种方法完成:
1. - (BOOL)canEvaluatePolicy:(LAPolicy)policy error:(NSError * autoreleasing *)error __attribute((swift_error(none))) 检测设备是否支持指纹识别;
2. - (void)evaluatePolicy:(LAPolicy)policy
localizedReason:(NSString *)localizedReason
reply:(void(^)(BOOL success, NSError * __nullable error))reply 识别指纹
代码:
LAContext *context = [LAContext new]; context.localizedCancelTitle = @"取消"; context.localizedFallbackTitle = @"密码登录"; NSError *error = nil; BOOL supportFingerPrint = [context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]; if (!supportFingerPrint) { NSLog(@"不支持指纹解锁:%@",error.localizedDescription); switch (error.code) { case LAErrorTouchIDNotEnrolled: NSLog(@"TouchID Not Enrolled"); break; case LAErrorPasscodeNotSet: NSLog(@"Password Not Set"); break; default: NSLog(@"TouchID Not Available"); break; } } else { NSLog(@"支持指纹解锁"); [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"指纹解锁" reply:^(BOOL success, NSError * _Nullable error) { if(success) { NSLog(@"指纹解锁成功"); } else { switch (error.code) { case LAErrorAuthenticationFailed: { NSLog(@"Authentication Failed"); } break; case LAErrorUserCancel: { NSLog(@"User Canceled"); } break; case LAErrorUserFallback: { [[NSOperationQueue mainQueue] addOperationWithBlock:^{ NSLog(@"User Fallback"); }]; } break; case LAErrorSystemCancel: { NSLog(@"System Cancel"); } break; case LAErrorPasscodeNotSet: { NSLog(@"Password Not Set"); } break; case LAErrorTouchIDNotAvailable: { NSLog(@"TouchID Not Available"); } break; case LAErrorTouchIDNotEnrolled: { NSLog(@"TouchID Not Enrolled"); } default: { [[NSOperationQueue mainQueue] addOperationWithBlock:^{ NSLog(@"Other Targat "); }]; } break; } } }]; }
0 0
- iOS指纹识别
- iOS指纹识别
- ios指纹识别
- iOS 指纹识别
- iOS 指纹识别
- iOS指纹识别
- iOS 指纹识别
- iOS 指纹识别
- iOS 指纹识别
- ios指纹识别
- iOS指纹识别
- iOS 指纹识别
- iOS 指纹识别
- iOS指纹识别iOS TouchID
- ios开发之指纹识别
- IOS开发-指纹识别
- IOS开发-指纹识别
- iOS开发--touchID指纹识别
- 短文本语义比对调研
- ARM FP寄存器及frame pointer介绍
- Vuex 2.0 源码分析
- 令仔代码收藏系列(二)----BASE64编码
- python实现简单的系统监控
- iOS指纹识别
- DHCP options
- html设置密码输入限制在十个字符
- css3 box-shadow阴影(外阴影与外发光)讲解
- bootstrap中常用的插件及示例
- JAVA动态任务SCHEDULEJOB
- 测试
- kali linux中文版终端字体重叠问题
- 静态局部变量