某些 iPad 设备 return 生物识别无法使用此代码,为什么?
Some iPad devices return biometrics not available with this code, why?
我在理解 return 值时遇到了一些问题,我在一个仅包含以下代码的新项目中得到的值。
- (void)viewDidLoad {
[super viewDidLoad];
LAContext* touchContext = [LAContext new];
NSError* policyEvaluationError = nil;
[touchContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
error:&policyEvaluationError];
NSLog(@"\n\n %@", policyEvaluationError);
}
这些是 iPad 模拟器的结果,iOS 10.3.1 - 11.3。
iPad (5th Generation) - "Biometry is not available on this device."
iPad Air - "Biometry is not available on this device."
iPad Air 2 - “No identities are enrolled."
iPad Pro (9.7-inch) - "Biometry is not available on this device."
iPad Pro (12.9-inch) (2nd generation) - "Biometry is not available on this device."
“生物识别在此设备上不可用”的这些结果。这些设备是否注册时都会发生。
还测试了所有 iPhone 设备类型 return“未注册任何身份。”像 iPad Air 2,我希望他们没有注册但拥有 touchID 硬件。注册的时候,根本就没有错误。
在一些实际的 iPad 设备上,结果似乎也有所不同,但方式不同。如果不存储指纹,某些设备 return“此设备不支持生物识别。”而其他人只是 return enrolled/nil。存储指纹后,它们的行为似乎都符合我的预期。
据我所知,我们已经在生产中使用这段代码很长一段时间了,没有收到与此主题相关的投诉,但我们最近才在 development/QA 中注意到它。
此代码是否在所有设备上都不可靠,是否可能发生了某些变化,或者我在这里做错了什么?
这是 Apple 框架中的错误,我已将其提交给 rdar://problem/46148637。如果你很好奇,这里是该报告的全文:
iPad Pro (12.9-inch) (2nd generation) simulator thinks it doesn't have Touch ID
Summary:
LAContext().canEvaluatePolicy(_:error:) with the policy LAPolicy.deviceOwnerAuthenticationWithBiometrics fails with LAError.Code. biometryNotAvailable on the iPad Pro (12.9-inch) (2nd generation) simulator. A bit of digging suggests that:
• LAContext().canEvaluatePolicy(_:error:), from LocalAuthentication.framework, ends up communicating with coreauthd to evaluate the policy.
• The specific error is generated in -[BiometryHelper deviceHasBiometryWithError:] in DaemonUtils.framework, which is loaded into coreauthd.
• -[BiometryHelper deviceHasBiometryWithError:] returns this error when -BiometryHelper._device is nil.
• BiometryHelper._device is the first object grabbed from +[BKDeviceManager availableDevices], in BiometricKit.framework.
• +[BKDeviceManager availableDevices] *should* create a Touch ID device descriptor if it finds that the device supports Touch ID, which it checks by calling MGGetBoolAnswer(@"touch-id").
• MGGetBoolAnswer(@"touch-id") returns NO (!)
• The device believes it does not have a Touch ID sensor.
• LAContext().canEvaluatePolicy(_:error:) returns false because it believes the device cannot evaluate this policy.
Steps to Reproduce:
1. Try to evaluate a biometric policy on the iPad Pro (12.9-inch) (2nd generation) simulator.
Expected Results:
I either receive a success, or something about being unenrolled.
Actual Results:
I'm told that this iPad doesn't have a Touch ID sensor, when clearly should have one.
Version/Build:
Xcode Version 10.1 (10B61)
Configuration:
Xcode Version 10.1 (10B61)/macOS Mojave 10.14.2 Beta (18C48a)
我在理解 return 值时遇到了一些问题,我在一个仅包含以下代码的新项目中得到的值。
- (void)viewDidLoad {
[super viewDidLoad];
LAContext* touchContext = [LAContext new];
NSError* policyEvaluationError = nil;
[touchContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
error:&policyEvaluationError];
NSLog(@"\n\n %@", policyEvaluationError);
}
这些是 iPad 模拟器的结果,iOS 10.3.1 - 11.3。
iPad (5th Generation) - "Biometry is not available on this device."
iPad Air - "Biometry is not available on this device."
iPad Air 2 - “No identities are enrolled."
iPad Pro (9.7-inch) - "Biometry is not available on this device."
iPad Pro (12.9-inch) (2nd generation) - "Biometry is not available on this device."
“生物识别在此设备上不可用”的这些结果。这些设备是否注册时都会发生。
还测试了所有 iPhone 设备类型 return“未注册任何身份。”像 iPad Air 2,我希望他们没有注册但拥有 touchID 硬件。注册的时候,根本就没有错误。
在一些实际的 iPad 设备上,结果似乎也有所不同,但方式不同。如果不存储指纹,某些设备 return“此设备不支持生物识别。”而其他人只是 return enrolled/nil。存储指纹后,它们的行为似乎都符合我的预期。
据我所知,我们已经在生产中使用这段代码很长一段时间了,没有收到与此主题相关的投诉,但我们最近才在 development/QA 中注意到它。
此代码是否在所有设备上都不可靠,是否可能发生了某些变化,或者我在这里做错了什么?
这是 Apple 框架中的错误,我已将其提交给 rdar://problem/46148637。如果你很好奇,这里是该报告的全文:
iPad Pro (12.9-inch) (2nd generation) simulator thinks it doesn't have Touch ID
Summary:
LAContext().canEvaluatePolicy(_:error:) with the policy LAPolicy.deviceOwnerAuthenticationWithBiometrics fails with LAError.Code. biometryNotAvailable on the iPad Pro (12.9-inch) (2nd generation) simulator. A bit of digging suggests that:
• LAContext().canEvaluatePolicy(_:error:), from LocalAuthentication.framework, ends up communicating with coreauthd to evaluate the policy.
• The specific error is generated in -[BiometryHelper deviceHasBiometryWithError:] in DaemonUtils.framework, which is loaded into coreauthd.
• -[BiometryHelper deviceHasBiometryWithError:] returns this error when -BiometryHelper._device is nil.
• BiometryHelper._device is the first object grabbed from +[BKDeviceManager availableDevices], in BiometricKit.framework.
• +[BKDeviceManager availableDevices] *should* create a Touch ID device descriptor if it finds that the device supports Touch ID, which it checks by calling MGGetBoolAnswer(@"touch-id").
• MGGetBoolAnswer(@"touch-id") returns NO (!)
• The device believes it does not have a Touch ID sensor.
• LAContext().canEvaluatePolicy(_:error:) returns false because it believes the device cannot evaluate this policy.
Steps to Reproduce:
1. Try to evaluate a biometric policy on the iPad Pro (12.9-inch) (2nd generation) simulator.
Expected Results:
I either receive a success, or something about being unenrolled.
Actual Results:
I'm told that this iPad doesn't have a Touch ID sensor, when clearly should have one.
Version/Build:
Xcode Version 10.1 (10B61)
Configuration:
Xcode Version 10.1 (10B61)/macOS Mojave 10.14.2 Beta (18C48a)