Touch ID

- (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(@"不支持");

    }

}


猜你喜欢

转载自blog.csdn.net/qq_30126571/article/details/51281649
id