Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Touch ID API responsive is very slow

I have followed the guidelines and also the example for Touch ID API from Apple documentation. I have used the example in my applications. I could able to login using Touch ID. But the problem is its responsive is very very slow. After I put my finger on the Touch ID , at least 10 seconds I have to wait to get verify success/failure. I have used the code in app delegate file. I have also tested with different apps but the result is the same "delayed response". Guys please help me in this case.

like image 669
user4150758 Avatar asked Oct 16 '14 18:10

user4150758


1 Answers

LAContext *myContext = [[LAContext alloc] init];

NSError *authError = nil;

NSString *myLocalizedReasonString = <#String explaining why app needs authentication#>;

if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {

    [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
              localizedReason:myLocalizedReasonString
                        reply:^(BOOL success, NSError *error) { 

                            if (success) {
                                   // User authenticated successfully, take appropriate action
                                   dispatch_async(dispatch_get_main_queue(), ^{
                                          // write all your code here
                               });
                            } else {
                                   // User did not authenticate successfully, look at error and take appropriate action

                               switch (error.code) {
                                   case LAErrorAuthenticationFailed:
                                       NSLog(@"Authentication Failed");
                                       break;

                                   case LAErrorUserCancel:
                                       NSLog(@"User pressed Cancel button");
                                       break;

                                   case LAErrorUserFallback:
                                       NSLog(@"User pressed \"Enter Password\"");
                                       break;

                                   default:
                                       NSLog(@"Touch ID is not configured");
                                       break;
                               }

                               NSLog(@"Authentication Fails");
                            }
                        }];
} else {
    // Could not evaluate policy; look at authError and present an appropriate message to user
}
like image 61
Vishal Gandhi Avatar answered Oct 17 '22 23:10

Vishal Gandhi