You should display warnings in the main thread with
dispatch_async(dispatch_get_main_queue(), ^{ //update ui }); LAContext *context = [[LAContext alloc] init]; NSError *error = nil; if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) { // Authenticate User NSError *error = nil; if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) { [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"Please verify that you are the device owner in order to place the order" reply:^(BOOL success, NSError *error) { dispatch_async(dispatch_get_main_queue(), ^{ if (error) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"There was a problem verifying your identity." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; return; } if (success) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success" message:@"You are the device owner!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"You are not the device owner." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; } }); }]; }
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device cannot authenticate using TouchID." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show];
}
Bibo lan
source share