当用户多次未能通过 TouchID 本地身份验证时,iOS 8 接管了我的应用程序的屏幕,这令人沮丧。我觉得我应该有控制权,我应该决定当用户失败并且我们的后端是这样编程的时该怎么做。
那么有什么方法可以关闭我的应用程序中间弹出的密码屏幕吗?
这是我用来在屏幕上弹出 TouchID 的代码:
-(void)checkFingerprint
{
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = @"Please scan your fingerprint to open app";
NSString *myFallbackTitle = @"";
[myContext setLocalizedFallbackTitle:myFallbackTitle];
//does this iPhone do fingerprint, is a at least one registered on the phone?
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError])
{
//yes it does, and the fingerprint is registered on the phone!
//now lets check for the fingerprint :)
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error){
dispatch_async(dispatch_get_main_queue(),
^{[self showLocalAuthenticationResult:success :error];});
}];
}
else
{
//Could not evaluate policy; look at authError and present an appropriate message to user
NSLog(@"checkFingerprint()::local authentication/fingerprint error remember both fingerprint and passcode have to be enrolled on iOS %@", authError);
}
}