Fix "since it does not conform to ATS policy"
![Fix "since it does not conform to ATS policy"](/content/images/size/w2000/2020/01/feature.png)
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 Source Code
:
![](https://programmingwithswift.com/content/images/2020/01/Screenshot-2020-01-01-at-10.24.04.png)
The next thing that we need to do is add our new key. Add the following code to your info.plist
:
<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, NSAppTransportSecurity
.