-1

I posted this question earlier but it was marked as a duplicate which in my opinion it is not. Here are the details.

I have a view that I use to access 7 URLs. Just one of these URLs does not load. The URL is correct and it loads from iOS Safari. The 6 other URLs load without problem. All URLs are http. How do I debug this? There are no error messages.

The suggestion referred to when my previous question was closed as duplicate was that I change NSAppTransportSecurity to NSAllowsArbitraryLoads YES, but that was already the case in info.plist. Is there somewhere else that I need to change ATS?

override func viewDidLoad ()
{
super.viewDidLoad ()
if Reachability.isConnectedToNetwork() == false
{
    showAlert ()
    let storyboard = UIStoryboard(name: "Main", bundle: nil)
let returnNC = myStack.pop()
let vc = storyboard.instantiateViewControllerWithIdentifier(returnNC!) 
self.presentViewController(vc, animated: true, completion: nil)
}
else {
    let fullURL  = defaults.objectForKey("URL") as? String
    let url = NSURL(string: fullURL!)
    let request = NSURLRequest(URL: url!)
    myWebView.loadRequest(request)
    }
}

func webView(webView: UIWebView!, didFailLoadWithError error: NSError!)      {
print("Webview fail with error \(error)");
}
PatriciaW
  • 893
  • 1
  • 12
  • 30

1 Answers1

0

To track this down, you need more information. Even though the web page exists in the browser, there may be other issues (such as transient connections / 404 responses, etc.).

UIWebView's didFailLoadWithError() function doesn't return response codes, which could provide some information that can help you debug. See the answer at this related StackOverflow post. If you find anything useful, update your question.

Community
  • 1
  • 1
rholmes
  • 4,064
  • 3
  • 25
  • 34