Why do I get 'App Transport Security has blocked a cleartext HTTP (http://) resource load'?

When using iOS applications, you might encounter the error message 'App Transport Security has blocked a cleartext HTTP (http://) resource load'. This occurs due to Apple's App Transport Security (ATS) feature, which enhances the security of your app by requiring secure connections to web services. ATS mandates the use of HTTPS instead of HTTP to improve data privacy and integrity.

To resolve this issue, you have a few options:

  • Use HTTPS for your requests.
  • If you need to connect to an HTTP resource temporarily, you can configure your app to allow it by adjusting your app's Info.plist file.

Here's an example of how to configure the Info.plist file to allow HTTP requests:

<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>

App Transport Security HTTP HTTPS iOS Info.plist secure connections data privacy