1、因為公司后臺自己配置的https證書,在正常瀏覽器中也是無法打開的,所以在wkwebiew里面也需要去手動配置才能正常顯示。
2、需要在plist文件中添加App Transport Security Settings這個選項下添加?Allow Arbitrary Loads 為YES。
3、WKWebview實現(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);
?}
}