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

倖福魔咒の 提交于 2019-11-30 04:06:08

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];

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
        }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!