objective-cswiftios9xcode7transport-security

No solution for Transport Security?


I have tried all the methods of here for solving the problem of: "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."

But if I try for example adding this in my plist file:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>www.myserver.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>

I get an error:"Unsupported URL", where in this case my link, looks like this:

let url:NSURL = NSURL(string: "www.myserver.com/jsonsignup.php")

But if I would use:

let url:NSURL = NSURL(string: "http://www.myserver.com/jsonsignup.php")

I would get the same error of Transport Security as mentioned above.

Any help?


Solution

  • I had the same issue. I tried adding it to info.plist but it did not work for me either. So I tried this and it worked.

    Click on your project name in the "Project Navigator" then click on info. And add it there. See highlighted.

    enter image description here

    Before I tried selecting the plist from my project navigator under supporting files and for some reason it did not work. The above should work for you.

    enter image description here

    Note: This will allow all connections.