1

我知道这可能是一个简单的问题,但我无法在互联网上找到我要查找的内容。我在我的项目中使用来自 iOS 8 的 LocalAuthentication 框架,我的代码在这里:

 if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
            [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
                    localizedReason:@"Let's just quickly check that you are the device owner."
                              reply:^(BOOL success, NSError *error) {
                                  dispatch_async (dispatch_get_main_queue(), ^{
                                      if (error) {
                                          // Error occurred
                                      } else if (success) {
                                          // Device owner, success!
                                      } else {
                                          // Not device owner
                                      }
                                  });
                              }];
        }

但我想知道用户何时点击“输入密码”,即LAErrorUserFallback. 但是我只想知道如何将error我在那里的变量与LAErrorUserFallback查看结果错误进行比较。

我试过这个:

if (error) {
    if (error == LAErrorUserFallback) {
       // User tapped 'Enter password'
    }
}

但显然这些不是同一类型。

有什么帮助吗?

4

1 回答 1

5

根据文档,这是错误代码。所以尝试类似的东西error.code == LAErrorUserFallback

于 2015-01-17T11:00:58.640 回答