美文网首页
[xxx.HWebView webView:didReceive

[xxx.HWebView webView:didReceive

作者: 90后的晨仔 | 来源:发表于2021-04-08 14:32 被阅读0次

项目中使用了WebViewJavascriptBridge这个框架,导致崩溃。

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Completion handler passed to -[xxx.HWebView webView:didReceiveAuthenticationChallenge:completionHandler:] was not called'

  • 解决方法:

github上解决方案

  • oc版本对应的解决方法
(void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler
{
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
}
  • swift 对应的解决方法:
  func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
        completionHandler(URLSession.AuthChallengeDisposition.performDefaultHandling,nil)
    }

相关文章

网友评论

      本文标题:[xxx.HWebView webView:didReceive

      本文链接:https://www.haomeiwen.com/subject/zlbmkltx.html