我遇到了一些问题,了解我在一个只有以下代码的新项目中获得的返回值。
- (void)viewDidLoad {
[super viewDidLoad];
LAContext* touchContext = [LAContext new];
NSError* policyEvaluationError = nil;
[touchContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
error:&policyEvaluationError];
NSLog(@"nn %@", policyEvaluationError);
}
这些只是iPad模拟器的结果,iOS 10.3.1-11.3。
iPad(第五代( - "生物特征有此设备上都没有。
iPad Air-生物特征在此设备上不可用。
iPad air 2-"没有注册身份。"
iPad Pro(9.7英寸( - "生物特征均可在此设备上可用。
iPad Pro(12.9英寸((第二代( - 本设备上没有生物特征。
这些设备上没有生物特征的这些结果。"当这些设备被注册时发生。
所有经过测试的iPhone设备类型还返回"没有注册身份"。像iPad Air 2一样,我期望它们没有入学,但拥有触摸性硬件。注册时,根本没有错误。
在某些实际的iPad设备上,结果似乎也有所不同,但并不相同。如果没有指纹存储,则某些设备在此设备上返回"无生物特征"。而其他人只是退还注册者/零。用指纹存储了,它们似乎都表现得如我所期望的。
据我所知,我们已经在生产中使用了此代码一段时间,而没有与此主题相关的抱怨,但是我们直到最近才在开发/QA中注意到它。
。此代码只是在所有设备上都不可靠,可能会更改某些东西,还是我在这里做错了什么?
这是Apple框架中的一个错误,我已将RDAR://QUACDER/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)