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

Why Insurance is a Must-Have for Every Business Owner

Best Fort Myers Car Accident Lawyers for Your Legal Needs

Best CRM Platforms for Small Business in 2023