我已经在我的项目中使用了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总是返回LABiometryTypeTouchID(1),但是iam使用的设备是iPad 11英寸,iOS 12.1.4 (只有faceid,没有touchid)。
但是如果我运行下面的evaluatePolicy: faceid UI就会被提示。但是即使在那之后,我得到了myContext.biometryType返回LABiometryTypeTouchID(1),你知道为什么它返回LABiometryTypeTouchID(1)而不是LABiometryTypeFaceID (2)吗?
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:
注意--这在iPhoneX和iOS 12.1.4上工作的很好,但是在iPad 11英寸iOS 12.1.4上却不能工作,奇怪的是...
发布于 2019-04-02 13:35:27
最终从苹果公司得到了以下答案。
看起来你的应用是基于iOS 11.xSDK构建的。在iOS 12之前,iPads的人脸识别功能被禁用,这就是为什么它被识别为触摸ID的原因。
请确保您使用最新的Xcode构建应用程序,这是针对iOS 12.xSDK的
https://stackoverflow.com/questions/55239807
复制相似问题