LAContext.biometryType 总是 returns LABiometryTypeTouchID

LAContext.biometryType always returns LABiometryTypeTouchID

我已经在我的项目中使用了 TouchID,现在我正在尝试使用 FaceId 进行身份验证,并且我正在使用以下代码。

LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
    if (![myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError])
    {
        NSLog(@"0001 , EVT, %@, %@, %@",[[self class] description], NSStringFromSelector(_cmd), [authError localizedDescription]);
        return NO;
    }
    
    if (@available(iOS 11.0, *))
    {
        if (myContext.biometryType == LABiometryTypeFaceID)
        {
            NSLog(@"0002 , EVT, %@, %@, FaceID Suppoted Device",[[self class] description],NSStringFromSelector(_cmd));
        }

  if (myContext.biometryType == LABiometryTypeTouchID)
        {
            NSLog(@"0002 , EVT, %@, %@, Touched Suppoted Device",[[self class] description],NSStringFromSelector(_cmd));
        }
    }

myContext.biometryType 总是 returns LABiometryTypeTouchID(1),但我使用的设备是 iPad 11 英寸 iOS 12.1.4(只有 faceid 没有 touchid) .

但是如果我运行 提示如下evaluatePolicy: faceid UI。但即使在那之后我得到 myContext.biometryType returns LABiometryTypeTouchID(1) , 知道为什么这个 returns LABiometryTypeTouchID(1) 而不是 LABiometryTypeFaceID (2) 吗?

[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
                  localizedReason:myLocalizedReasonString
                            reply:

注意 - 这在 iOS 12.1.4 的 iPhoneX 上完美运行,但在 iPad 11 英寸 iOS 12.1.4 奇怪...

终于得到苹果的如下回答

您的应用似乎是针对 iOS 11.x SDK 构建的。 iOS 12 之前的 iPad 禁用了 Face ID 功能,这就是它被识别为 Touch ID 的原因。

请确保您使用最新的 Xcode 构建应用程序,这是针对 iOS 12.x SDK