I am going to add safari extension in my app. I need biometric authentication for validate user. when I evaluate device owner authentication via Local Authentication then an error found.
[Error Domain=com.apple.LocalAuthentication Code=-1004 "Caller is not running foreground." UserInfo={NSDebugDescription=Caller is not running foreground., NSLocalizedDescription=User interaction required.}]
My Question is how may I force to safari extension to be in foreground to fix this issue? Or let me know if I can use any other way.
Code:
-(void)doBioMatricAuth{
context = [LAContext new];
context.localizedCancelTitle = @"Enter Username/Password";
if([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:nil]){
dispatch_async(dispatch_get_main_queue(), ^{
NSString *reason = @"Log in to your account";
[self->context evaluatePolicy:LAPolicyDeviceOwnerAuthentication localizedReason:reason reply:^(BOOL success, NSError * _Nullable error) {
if(success) {
NSLog(@"Biomatric success");
} else {
NSLog(@"Biomatric Failed %@",error.localizedDescription);
}
}];
});
}
}