0
点赞
收藏
分享

微信扫一扫

WKWebView设置支持https

幺幺零 2023-02-15 阅读 119


要实现下面代理方法,当然别忘了设置代理navigationDelegate

/**
* 加这个方法https 支持
**/
- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler{
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
NSURLCredential *card = [[NSURLCredential alloc]initWithTrust:challenge.protectionSpace.serverTrust];
completionHandler(NSURLSessionAuthChallengeUseCredential,card);
}
}

举报

相关推荐

0 条评论