检测到触摸ID已启用

时间:2016-10-04 10:43:31

标签: ios objective-c xcode

我正在iOS上编写一个objective-c应用程序,我需要检测是否已设置Touch ID而不显示身份验证对话框。我当然可以用它来解决这个问题;

[myContext
evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString reply:^(bool succes, NSError
*error)

但这将是一个身份验证对话框。

1 个答案:

答案 0 :(得分:0)

好的想通了,事实证明它简直令人尴尬;

    LAContext *myContext = [[LAContext alloc] init];
    NSError *authError = nil;
    NSString *myLocalizedReasonString = @"Authenticate using your finger";

    if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError])
    {
        //if you get here, touch id has been set up
        TouchIDSetup = true;
    }