1

I'm upgrading an app to Swift 2 (Xcode 7).

When I'm loading a URL in a Webview a strange problem occurs: some HTTPS URLs won't load. Other URLs (also HTTPS) are working fine.

I already tried setting the NSAppTransportSecurity - NSAllowsArbitraryLoads to YES, but this doesn't fix the problem. Does anybody have any idea what may cause this issue?

Also tried to log via

setenv("CFNETWORK_DIAGNOSTICS", "3", 1);

but actually I don't know what to search for in the log file in order to track down the cause of this problem.

3
  • Make your class which host the webview conforms to the protocol UIWebViewDelegate and give the implementation for delegate method.func webView(webView: UIWebView, didFailLoadWithError error: NSError?) { }, capture the error code and share which would help more. Sep 29, 2015 at 8:26
  • Tried this. Found out that the problem occurs when a 302 redirect is made by a specific domain. What I do not understand is that the redirect seems to work fine in Safari (iPhone) and other browsers, but fails in a webview. Also tried other pages with a 302 redirect, which are also working just fine. Is there a way to show/log the received headers?
    – klaaskox
    Sep 29, 2015 at 14:16
  • Does this answer your question? URL not loading in webview but loaded in browser in android?
    – Chaurasia
    Jan 25, 2020 at 10:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.