ios - safariViewController debugging - URL not loading -
i'm using sfsafariviewcontroller in ios 9 app i'm building using swift 2.
i trying open url fails reason. every other url i've tried works, except one:
http://www.ctvnews.ca/sci-tech/33-engineers-to-be-recognized-at-sci-tech-oscars-1.2730223
the url fine in regular mobile safari in simulator, on iphone, ipad, , in desktop browser. when try accessing via swift in app fails.
code follows:
func openinsafari(urltoopen: string) { print("trying openurl: " + urltoopen) let safarivc = sfsafariviewcontroller(url:nsurl(string: urltoopen)!, entersreaderifavailable: false) safarivc.delegate = self self.presentviewcontroller(safarivc, animated: true, completion: nil) } func safariviewcontroller(controller: sfsafariviewcontroller, didcompleteinitialload didloadsuccessfully: bool) { // sfsafariviewcontroller present error message in browser, // in case dismiss view controller , present our // own error alert. if didloadsuccessfully == false { controller.dismissviewcontrolleranimated(true, completion: { [unowned self] () -> void in let alert = uialertcontroller(title: "could not load", message: "the url not loaded.", preferredstyle: .alert) alert.addaction(uialertaction(title: "okay", style: .default, handler: nil)) self.presentviewcontroller(alert, animated: true, completion: nil) }) } } this code works fine, and, said, other urls load fine. need way more verbosely debug safariviewcontroller encountering causing fail.
the didloadsuccessfully == false line doesn't appear offer more debugging options sense of went wrong.
in other words, how debug this? can't seem find in apple's docs explain check in case of loading error.
please help! thanks.
the sfsafariviewcontroller voluntarily shielded app (i wouldn't surprised if it's different process), , there's little information shared app privacy , security reasons.
what try loading same based in uiwebview or wkwebview (which gives lot more feedback, doesn't share cookies or passwords safari) see happens then.
Comments
Post a Comment