UIWebView won't load links with certificate (https:// prefix)

前端 未结 2 441
心在旅途
心在旅途 2020-12-29 00:00

I know this has been asked before but I have looked at every answer (there aren\'t many) and none help me.

The issue I am running into is dealing with certificates

相关标签:
2条回答
  • 2020-12-29 00:50

    Fixed my issue, I was able to load https with no problem with the following code I didn't think this would work but it does!:

    NSURLRequest *req = [NSURLRequest requestWithURL:mURL];
    urlConnection=[[NSURLConnection alloc] initWithRequest:req delegate:self];
    webView.scalesPageToFit = YES;
    [webView loadRequest:req];
    
    0 讨论(0)
  • 2020-12-29 00:50

    Web view does not load https urls due to certificate mismatch. After writing this extension it would work as expected

    Swift 2.2

      extension NSURLRequest {
            static func allowsAnyHTTPSCertificateForHost(host: String) -> Bool
            {
                return true
            }
        }
    
    0 讨论(0)
提交回复
热议问题