1幻赚、因?yàn)楣竞笈_(tái)自己配置的https證書覆享,在正常瀏覽器中也是無(wú)法打開的,所以在wkwebiew里面也需要去手動(dòng)配置才能正常顯示寥袭。
2路捧、需要在plist文件中添加App Transport Security Settings這個(gè)選項(xiàng)下添加?Allow Arbitrary Loads 為YES。
3传黄、WKWebview實(shí)現(xiàn)一下代理即可
- (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);
?}
}