iOS 7 and above doesn't allow clear http

fabiodelorenzo
Posts: 65
Joined: Thu Oct 03, 2013 5:54 pm

iOS 7 and above doesn't allow clear http

Postby fabiodelorenzo » Mon Dec 21, 2015 3:46 am

if you get this error:
App Transport Security has blocked a cleartext HTTP


Open the file info.plist, under Supporting Files.
Open As -> Source Code

And, before the last </dict> add:

Code: Select all

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>yourserver.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>


Change yourserver.com with your domain name.

Or to allow all the domains:

Code: Select all

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

Return to “NSURLSession for networking and JSON”

Who is online

Users browsing this forum: No registered users and 0 guests