iOS 开发 指纹识别解锁详解

来源:互联网 发布:施工网络计划图模板 编辑:程序博客网 时间:2024/05/18 04:00
#pragma mark - 指纹识别解锁- (void)fingerprintIdentification {    // 1.创建上下文    LAContext *context = [[LAContext alloc] init];    // 2.判断指纹识别是否可用    // LAPolicyDeviceOwnerAuthentication:在iOS9类型  可以输入密码    // LAPolicyDeviceOwnerAuthenticationWithBiometrics  iOS8使用 不可以输入密码    if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:nil]) {        // 3.开启指纹识别        // localizedReason:使用原因        [context evaluatePolicy:LAPolicyDeviceOwnerAuthentication localizedReason:@"通过Home键验证已经有手机指纹" reply:^(BOOL success, NSError * _Nullable error) {            if (success) {                ZYLog(@"验证成功");                // 跳转界面            }            if (error) {                // -1表示验证失败                // -8表示验证失败次数过多                // -3表示在iOS8类型中点击了输入密码                ZYLog(@"%zd",error.code);            }        }];    }}

这里写图片描述
这里写图片描述
这里写图片描述

0 0
原创粉丝点击