在升級iOS13.0 13.1時,指紋設備LAContext函數(shù)調用指紋顯示UI慢甚至不顯示UI,目前來看是蘋果的bug。指紋傳感器在進行著檢測,而指紋UI無法顯示出來。通過查閱資料,網上有很多大神發(fā)現(xiàn)了手指放到home鍵上,可以及時的彈出驗證ui,或者晃動設備也可顯示出UI。
筆者想著使用模擬搖晃的方法,及時顯示出UI,奈何才疏學淺,不知從何下手。
后通過官方論壇發(fā)現(xiàn),如果想及時顯示出指紋驗證UI,可通過調用兩次evaluatePolicy:方法。
話不多說,代碼如下:
LAContext*context = [[LAContext alloc]init];
__block NSString*message;
context.localizedFallbackTitle = @"Enter PIN";
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"Unlock access to locked feature" reply:^(BOOL success, NSError * _Nullable error) { }];
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"Unlock access to locked feature" reply:^(BOOL success, NSError *authenticationError) {
if(success) {
message =@"evaluatePolicy: succes";
}else{
message = [NSStringstringWithFormat:@"evaluatePolicy: %@", authenticationError.localizedDescription];
}
[self printMessage:message inTextView:self.textView];
}];
如果覺得對你有用,請點個贊!(▽)