I had a working app that downloads some info from an http domain. But after the Swift 2.0 and Xcode 7 update, my app can't connect to the server and download the json data, I get the "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." error.
I have tried putting this lines in my info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
But I get the same error, it's not working. I always get nil data from the download methods. Any one has this same error? Thanks!
EDIT: Here is a picture from my info.plist file:
If you need to load a
http://
resource only in web (UIWebView/WKWebView/SafariViewController) then the following should suffice.None of the previous solutions worked for me, I had the NSAllowsArbitraryLoads set to true, but still HTP wont work, after looking around I noticed that the info.plist file has NSExceptionDomains section, so I deleted it for testing and everything worked.
So it seems that having NSExceptionDomains cancels the NSAllowsArbitraryLoads, hope this is helpful.
Did you try to add your domain such as? You should add it into
NSAppTransportSecurity
dictionary.I had a similar issue and after a while I figured out that the info.plist file was corrupted. I can only advise to check the xml directly not only the plist editor in xcode.