fingerprint - How to wait TouchID until it finishes? -


i want integrate touchid in application. based on true fingerprint, let user authenticate/not authenticate. so, in viewwillappear of viewcontroller, have written following code:

- (void)viewwillappear:(bool)animated { [super viewwillappear:animated];  if ([appconfig getsettingwithkey:app_token_key] != nil ){      if ([appconfig getistouchidpreferred] == preferred){          bool shouldauthenticate: [mytouchidclass authenticatewithfingerprint];         if (shouldauthenticate == yes){             //normal flow         }      } } 

}

here, authenticatewithfingerprint main job , code:

lacontext *context = [[lacontext alloc] init]; nserror *error = nil;  __block bool tobereturned = no; if([context canevaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics error:&error]){     [context evaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics             localizedreason:@"are device owner?"                       reply:^(bool success, nserror *error) {                           if(error){                               uialertview *alert = [[uialertview alloc] initwithtitle:@"error"                                                                               message:@"there problem verifying identity."                                                                              delegate:nil                                                                     cancelbuttontitle:@"ok"                                                                     otherbuttontitles:nil];                               [alert show];                                return;                           }                           if(success){                               tobereturned = yes;                               return;                             } else {                               uialertview *alert = [[uialertview alloc] initwithtitle:@"error"                                                                               message:@"you not device owner."                                                                              delegate:nil                                                                     cancelbuttontitle:@"ok"                                                                     otherbuttontitles:nil];                               [alert show];                               return;                           }                       }]; } else {     uialertview *alert = [[uialertview alloc] initwithtitle:@"error"                                                     message:@"your device cannot authenticate using touchid."                                                    delegate:nil                                           cancelbuttontitle:@"ok"                                           otherbuttontitles:nil];     [alert show]; }  return tobereturned; 

however, problem if block in viewwillappear method not wait authenticatewithfingerprint method , returns false, meaning if user logs in, won't authenticated.

so, how make if block wait authenticatewithfingerprint method?

thanks :)

you should not attempt block main thread while wait touchid.

what should instead insert new viewcontroller ahead of 1 trying block access , present touchid prompt on screen. when authenticated, push viewcontroller restricting access on stack.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -