12 Apr 2023 . 2 min read @gurjitpt
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".
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.
I’m Computer Science graduate and an iOS Engineer who writes about Swift and iOS development. Follow me on twitter @gurjitpt for more updates.
Enumerations (enum) enables you to write code in a type safe way. Enum is very useful while defining common type of values. You don't have to provide...
Mar 7, 2023 . 2 min read Swift Enum
Optional unwrapping is one of the most used patterns in iOS development. Swift 5.7 introduces new features included a new way to unwrap optional values...
Jun 14, 2022 . 2 min read Optional unwrapping
It's a common pattern or technique in various programming languages when we want to perform some action when a value is changed. Property ...
May 24, 2021 . 2 min read Property Observers