美文网首页程序员
iOS -- WKWebView-访问HTTPS-SSL证书无

iOS -- WKWebView-访问HTTPS-SSL证书无

作者: biubiuboom | 来源:发表于2020-05-10 11:34 被阅读0次

- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler {
    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
        NSURLCredential * card = [[NSURLCredential alloc] initWithTrust:challenge.protectionSpace.serverTrust];
        completionHandler(NSURLSessionAuthChallengeUseCredential,card);
    }
}

相关文章

网友评论

    本文标题:iOS -- WKWebView-访问HTTPS-SSL证书无

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