查看iPhone 5s上是否启用了Touch ID [英] See if Touch ID is enabled on iPhone 5s

查看:129
本文介绍了查看iPhone 5s上是否启用了Touch ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道iPhone 5S上的Touch ID无法通过SDK被任何其他应用程序使用,但我想知道应用程序是否可以至少查看设备上是否启用了Touch ID。这可以作为应用程序的额外安全因素,以查看是否已在iPhone 5S上启用Touch ID。我知道MDM产品可以做到这一点,应用程序需要使用特殊的API来确定这些信息吗?

I know the Touch ID on the iPhone 5S cannot be consumed by any other apps through the SDK, but I wanted to see if it was possible for an app to at least see if the Touch ID is enabled on the device. This can act as an additional security factor for an app to see if the Touch ID has been enabled on an iPhone 5S. I know MDM products can do this, is there a special API an app would need to use to determine this information?

推荐答案

您要查找的方法是 LAContext canEvaluatePolicy:错误:
在下列情况下,它将返回NO:

The method you are looking for is LAContext's canEvaluatePolicy:error:. It will return NO in the following cases :


  • 设备上没有Touch ID。

  • 设备上未设置密码。

  • 触摸ID没有已注册的手指。

此处有更多信息:本地身份验证框架参考

- (BOOL) isTouchIDAvailable {
    LAContext *myContext = [[LAContext alloc] init];
    NSError *authError = nil;

    if (![myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {

        NSLog(@"%@", [authError localizedDescription]);
        return NO;
    }
    return YES;
}

这篇关于查看iPhone 5s上是否启用了Touch ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆