美文网首页
WKWebiew加载https网址白屏

WKWebiew加载https网址白屏

作者: iOS乐乐 | 来源:发表于2020-03-12 08:48 被阅读0次
    - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler{
    
        if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
            if (challenge.previousFailureCount == 0) {
                NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
                completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
            } else {
                completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
            }
        }
        
        
    }
    

    相关文章

      网友评论

          本文标题:WKWebiew加载https网址白屏

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