I am trying to get the ATS setting NSAllowsArbitraryLoadsInWebContent working in my iOS app and for some reason, the setting seems be be ignored. I put together a quick test app to make sure none of my other Info.plist settings were breaking things, but insecure links are still getting rejected in both UIWebViews and WKWebViews. Here are the ATS settings in my Info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
And here is my the code in my controller with the UIWebView:
override func viewDidLoad() {
super.viewDidLoad()
webView.delegate = self
let url = URL(string: "https://www.salliemae.com/smartoption/")
let request = URLRequest(url: url!)
self.webView.loadRequest(request)
}
Any help would be appreciated.
So it looks like the issue was due to a bug in the version of Xcode I was using that wasn't respecting the NSAllowsArbitraryLoadsInWebContent flag. Updating to Xcode 8.2 beta (8c30a) fixed the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With