Search code examples
iosuiwebviewios9app-transport-security

App Transport Security Key not working in info.plist


My info.plist is set as follows:

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

enter image description here However when loading "www.google.com" into a UIWebView, I still receive an ATS security error:

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


Solution

  • In my case the issue was actually that the info.plist file was not properly assigned to my target. The key in the Plist was correct. At some point I had divided my app into 2 targets for a lite and pro version, each with their own info.plist, however they were not properly assigned.

    This can be checked underTarget > Build Settings > Search for "Info.plist" > Change path under targeting