问题描述
我正在使用以下代码将FaceID / TouchID集成到我的应用程序中。由于我不需要“输入密码”的后备选项,因此我不确定在这种情况下FaceID / Touch ID的最大尝试次数。为了禁用后备广告,我提供了以下代码:
myContext.localizedFallbackTitle = @"";
生物识别集成的代码为:
- (void)authenicateButtonTapped{
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
Nsstring *myLocalizedReasonString = @"Touch ID Test";
myContext.localizedFallbackTitle = @"";
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success,NSError *error) {
NSLog(@"success");
if (success) {
Nsstring *str = @"You are the owner of device";
NSArray * result = [[NSArray alloc] initWithObjects:str,nil];
dispatch_async(dispatch_get_main_queue(),^{
// executeClosure(callBack,result,NO);
});
} else {
switch (error.code) {
case LAErrorAuthenticationFailed:
NSLog(@"Authentication Failed");
break;
case LAErrorUserCancel:
NSLog(@"User pressed Cancel button");
break;
case LAErrorUserFallback:
NSLog(@"User pressed Enter Password");
break;
case LAErrorPasscodeNotSet:
NSLog(@"Passcode Not Set");
break;
case LAErrorBiometryNotAvailable:
NSLog(@"Touch ID not available");
break;
case LAErrorBiometryNotEnrolled:
NSLog(@"Touch ID not Enrolled or configured");
break;
default:
NSLog(@"Touch ID is not configured");
break;
}
NSArray * result = [[NSArray alloc] initWithObjects:error.localizedDescription,nil];
NSLog(@"Failure error: %@",result);
NSLog(@"biometry disabled Error code %ld",(long)error.code);
dispatch_async(dispatch_get_main_queue(),^{
// executeClosure(callBack,NO);
// Rather than show a UIAlert here,use the error to determine if you should push to a keypad for PIN entry.
[self presentAlertControllerWithMessage:error.localizedDescription];
});
}
}];
} else {
NSArray * result = [[NSArray alloc] initWithObjects:authError.localizedDescription,nil];
dispatch_async(dispatch_get_main_queue(),^{
NSLog(@"Failure when biometry hardware not there%@",result);
NSLog(@"biometry hardware Error code %@",authError);
// executeClosure(callBack,NO);
// Rather than show a UIAlert here,use the error to determine if you should push to a keypad for PIN entry.
[self presentAlertControllerWithMessage:authError.localizedDescription];
});
}
}
此图像显示,在3次失败的Touch ID和2次FaceID尝试失败之后。操作系统提供了一个后备选项,但是由于我不希望使用后备选项。
- 我已通过提供空字符串
myContext.localizedFallbackTitle = @"";
来禁用它。在这种情况下 TouchID / FaceID的最大尝试次数是多少? - FaceID / TouchID在5后将被禁用是什么意思 系统范围内的尝试失败?是FacedID 5还是5 分别触摸ID?请帮助我理解这一点。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)