Dealing with App Transport Security in Xcode


What is App transport security(ATS)?

App transport security improves user security and privacy by making secure connections to network.

When we try to make network requests, a console error has been printed.

App Transport Security has blocked a cleartext HTTP connection since 

it is insecure. Use HTTPS instead or add Exception Domains to your 

app's Info.plist.

It indicates that ATS is blocking insecure connections. You must use HTTPS in the URL to make secure connections or update the Info.plist file with a key that grants a temporary exemption.

The info.plist file is a dictionary of information about an app used while deploying it to the App Store. Adding the ATS exemption key in the Info.plist file means we are saying that app might make insecure connections.

Open the Info.plist file from the project navigator, and you will see the default set of keys for an app.

Click on “Information Property List” and plus sign (+) will appear. To add a new key to the file, click the plus sign (+). To allow HTTP requests, you have to add the key “App Transport Security Settings”


App Transport Security Security Settings has a dictionary value. Click on the key name, then click on the plus sign (+), and add the key “Allow Arbitrary Loads”. The value of this key is a boolean that should be set to “Yes”.


Conclusion

While working with network requests, always try to work with a secure HTTPS network. It helps the app perform secure network requests. If your API does not provide a secure connection, then use an exemption key to perform network requests.

Comments

Popular posts from this blog

Mastering the Information Avalanche: Your Roadmap to Conquer Digital Overload

Navigating the Investment Landscape with Canvas Investment Partners

HEB Community Investment: Nurturing Communities for a Brighter Tomorrow