IOS 9 App Transport Security has blocked a cleartext HTTP Issue

Mobile Developer picture Mobile Developer · Sep 4, 2015 · Viewed 7k times · Source

I am testing my app in Xcode 7, IOS 9 and got the following 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.

So I have done some changes in Info.plist file as below and application is now working fine across all IOS Versions:

<key>NSAppTransportSecurity</key><dict>
<key>NSExceptionDomains</key><dict><key>myserver.com</key><dict>
<key>NSIncludesSubdomains</key><false/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/></dict> </dict></dict>

So my doubt is whether this remains a permanent fix or whether I should use NSURLSession in my code.

Thanks, Abin

Answer

alcaamado picture alcaamado · Sep 28, 2015

Adding the following to your Info.plist will disable ATS

<key>NSAppTransportSecurity</key>  
<dict>  
    <key>NSAllowsArbitraryLoads</key><true/>  
</dict>