我想在我的WebView项目中使用Touch ID。如果我的webview加载某个网址,我想要显示touchid身份验证。我的问题是如何在认证成功后暂停和恢复加载?
我在方法" shouldStartLoadWithRequest"中有以下代码:
if([url isEqualToString:@"...=thisismyurl"]){ LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = @"Please Authentificate";
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
????
} else {
// User did not authenticate successfully, look at error and take appropriate action
NSLog(@"NEIN");
}
}];
}}
重要提示:解决方案是我最后的评论!
答案 0 :(得分:0)
我拥有它!现在我有一个if之前。使用此if条件,程序可以查看来自按钮的调用是否为示例。这是我的解决方案:
if (navigationType == UIWebViewNavigationTypeFormSubmitted) { ... }