iOS9 – The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

A new version of iOS always brings new changes. This one was encountered while doing our yearly Ad-Hoc Distribution Profile renewal. An App that hasn’t been changed in a while suddenly no longer wants to make web requests. Nothing is seen on the iDevice except for a blank table. Debugging in XCode we get the following error message:

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

The permenant fix is to add an SSL certificate to your HTTP endpoint and make sure all requests are HTTPS but this being a client environment I couldn’t wait for them to do so and just needed to implement the work-around as follows:

  1. Open your projects [ProjectName]-info.plist file
  2. Add a new key called NSAppTransportSecurity as a Dictionary
  3. Add a sub-key called NSAllowsArbitraryLoads as Boolean and set its value to YES (see image below)

NSAppTransportSecurity

Now just build and you are set!

Note: this is a blanket exemption but you can also further configure as mentioned here (How do I load an HTTP URL with App Transport Security enabled in iOS 9?)

Leave a Reply

Your email address will not be published. Required fields are marked *