During the development process, there may be some cases where HTTPS requests fail to display the web page or HTTPS images in the web page

The solution

1. InplistThe file will beAllow Arbitrary Loads in Web ContentSet toYESIf you have setNSAllowsArbitraryLoadsYES, do not set above

2. Add proxy method to wkWebView

// Load untrusted 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); }}Copy the code