Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ATS setting NSAllowsArbitraryLoadsInWebContent not working

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.

like image 357
JonahGabriel Avatar asked Apr 15 '26 07:04

JonahGabriel


1 Answers

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.

like image 82
JonahGabriel Avatar answered Apr 16 '26 22:04

JonahGabriel