Transport security has blocked a cleartext HTTP Transport security has blocked a cleartext HTTP ios ios

Transport security has blocked a cleartext HTTP


Use NSAppTransportSecurity:

Enter image description here

You have to set the NSAllowsArbitraryLoads key to YES under NSAppTransportSecurity dictionary in your info.plist file.

Plist configuration


See the forum post Application Transport Security?.

Also the page Configuring App Transport Security Exceptions in iOS 9 and OSX 10.11.

For example, you can add a specific domain like:

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

The lazy option is:

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

Note:

info.plist is an XML file so you can place this code more or less anywhere inside the file.