Hi guys, I try to implement Touch Id for login in an application I develop but I need help about error handling. My problem is how to show up pin pad in a logging problem. Is there a default pin pad screen like Apple use or we have to design it as an developer? Here my code is
Code:
LAContext *laContext = [[LAContext alloc] init];
NSError *error = nil;
NSString *warningString = @"Used for quick and secure access to the application";
if ([laContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
[laContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:warningString reply:^(BOOL success, NSError * _Nullable error) {
if (success) {
dispatch_async(dispatch_get_main_queue(), ^{
[self performSegueWithIdentifier:@"successSegue" sender:nil];
});
} else {
switch ([error code]) {
case LAErrorAuthenticationFailed: {
NSLog(@"AUTHENTICATION FAILED");
break;
}
case LAErrorUserFallback: {
NSLog(@"KLAVYE GÖSTER");
break;
}
case LAErrorUserCancel: {
NSLog(@"USER CANCELED");
break;
}
default:
break;
}
}
}];
} else {
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"Warning" message:@"This feature is not supported by the device" preferredStyle:UIAlertControllerStyleAlert];
[controller addAction:[UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
}]];
[self presentViewController:controller animated:true completion:nil];
});
}