我已经实现了一个锁定屏幕,每隔3分钟就会启动一个密码屏幕。如果用户具有触摸ID,则我启动Touch ID。
OCTouchIdManager *touchManager = [[OCTouchIdManager alloc]init];
if([touchManager isTouchIdAvilable] &&(userEabled) && passphraseLockStatusValue ){
[touchManager authenticateUserSuccess:^(void){
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
[self proceedOnSuccess];
});
});
}
fallBackBlock:^(NSInteger error){
//if error 1 then fall back (either the user clicked cancel or enter password)
//if error 2 then touch id fail (wrong finger)
if(error==1){
// do nothing, assume that the user will now user the mass passphase lock to verify.
}else if (error ==2){
[self showInvalidPasswordAlert];
}
}];
}
和我的touchIDManager
-(void)authenticateUserSuccess:(TouchIdSuccessBlock)successBlock fallBackBlock:(TouchIdFallBackBlock)fallbackBlock{
self.laContext.localizedFallbackTitle=@"Enter Passphrase";
[self.laContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:@"Please Login With your Touch ID to continue."
reply:^(BOOL success, NSError *error) {
if (error) {
//There was a problem verifying your identity"
fallbackBlock(1);
return;
}
if (success) {
successBlock();
} else {
//"You are not the device owner."
fallbackBlock(2);
}
}];
}
但是在某些设备中有时会出现两次触摸ID屏幕。意思是,有一个小闪烁。 这个问题很小,但它仍然让许多用户感到恼火。还有其他人有问题吗?我该如何解决呢。