This is a question I have personally asked multiple times during my iOS development career.
If you are trying to connect to insecure servers you will run into this issue,
since it does not conform to ATS policy. This is a simple issue to fix and we will learn how to fix it in this tutorial.
The way to fix this is to add a new key to your apps
info.plist. To add this key, right click on your
info.plist and select
Open As, then select
The next thing that we need to do is add our new key. Add the following code to your
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
If you are not sure where this goes, mine looks like something like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <!-- All the other keys and values --> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> </dict> </plist>
And that is all that needs to be done to get around
since it does not conform to ATS policy issue.
If you want more information on the
ATS Policy, you can find it here, and then look for the heading,