2
我正在努力添加LocalAuthentication框架以允許用戶使用類似設備上的指紋進行身份驗證。一切工作正常,但是當用戶通過指紋進行身份驗證時,需要10-15秒才能執行正確的安全操作,這是典型的,還是在我對用戶進行身份驗證時出現了問題? 代碼:你如何提高LoginAuthentication的速度?
-(void)viewDidLoad { [super viewDidLoad]; [self.view setBackgroundColor:[NPSColor NPSBackgroundColor]];
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Register" style:UIBarButtonItemStylePlain target:self action:@selector(onRegisterTapped)]; self.navigationItem.rightBarButtonItem = anotherButton;
LAContext *context = [[LAContext alloc] init];
NSError *error = nil; if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) { [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"Login?" reply:BOOL success, NSError *error {
if (error) {
}
if (success) {
[self performSegueWithIdentifier:@"loginSeg" sender:self];
} else {
}
}];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Your device cannot authenticate using TouchID."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
} }
沒錯,就是這樣!謝謝,我甚至不認爲它可能爲我處理一些多線程。 – Nathan 2014-12-03 18:23:36
隨時!很高興看到它幫助:) – 2014-12-04 18:12:55