错误描述如下:
Error Domain=com.apple.LocalAuthentication Code=-1000 "Pending UI mechanism already set." UserInfo=0x17406b0c0 {NSLocalizedDescription=Pending UI mechanism already set.}
我也在尝试Apple的示例示例应用程序并收到相同的错误。以前它工作正常,但它突然停止工作,无法正常工作。请帮忙。
我正在使用 iPhone 6 和 iOS 8.1
这段代码对我来说很好用。
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = @"String explaining why app needs authentication";
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
NSLog(@"User authenticated successfully, take appropriate action");
} else {
// User did not authenticate successfully, look at error and take appropriate action
NSLog(@"User did not authenticate successfully, look at error and take appropriate action");
}
}];
} else {
// Could not evaluate policy; look at authError and present an appropriate message to user
NSLog(@"Could not evaluate policy: %@",authError);
}
不要忘记导入本地身份验证框架<LocalAuthentication/LAContext.h>.
希望这能解决您的问题。
尝试重新启动手机。
我也开始收到此错误,并决定查看其他应用程序是否受到影响。我为Touch ID设置了Dropbox和Mint.当然,Touch ID也不适合他们,他们正在回退到密码。
我重新启动了手机,它又开始工作了,所以看起来Touch ID可能会出错并停止工作。顺便说一句,我在 iOS 8.2 上。
我想处理这种情况的正确方法是像那些应用程序一样,回退到密码/密码。