如何判断iOS设备是人脸还是触摸?

nszi6y05  于 2023-06-07  发布在  iOS
关注(0)|答案(1)|浏览(240)

当我在设置上关闭face id时,我得到如下错误:

LAContext *myContext = [[LAContext alloc] init];
    NSError *authError = nil;
    [myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]

authError是“No identities are enrolled.”这个错误并没有说明手机是touch id还是face id,我怎么判断ios设备是face还是touch?
我试过不同的iPhone设备,authError是“没有身份注册”。我无法确定iOS设备是面部还是触摸。

col17t5w

col17t5w1#

LAContext对象的biometryType属性告诉您当前设备上可用的生物识别身份验证类型:

LAContext *myContext = [[LAContext alloc] init];
switch (myContext.biometryType) {
    case LABiometryTypeFaceID:
        // Do something with Face ID
    break;

    case LABiometryTypeTouchId:
       // Do something with Touch ID
    break;

    case LABiometryTypeNone:
       // Biometrics are not available
}

相关问题