What i'm trying to do is open a website in Safari, through having the user click on a link that is displayed in my UIWebView.
I started by reading through the question/answers on: Open specific link in Safari from UIWebView
Afterwhich I implemented the following:
class HomeInfoView: UIViewController, UIWebViewDelegate{
override func viewDidLoad() {
super.viewDidLoad()
let localfilePath = NSBundle.mainBundle().URLForResource("homeInfo", withExtension: "html");
let myRequest = NSURLRequest(URL: localfilePath!);
WebViewer.loadRequest(myRequest);
WebViewer.scrollView.bounces = false
}
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
if let url = request.URL where navigationType == UIWebViewNavigationType.LinkClicked {
UIApplication.sharedApplication().openURL(url)
return false
}
return true
}
However when trying to use the link I still get an error
"App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file."
I think I'm 90% of the way there, yet I'm not sure how to edit my .plist to allow the exception. Or if there is something else that I've missed.
(I would've added this as a comment to the original post but my rank isn't high enough yet)