iOS: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection (NSURLErrorDomain -1022)
iOS blocks plain HTTP connections by default unless the domain is allowed in Info.plist.
App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecureNSURLErrorDomain error -1022The resource could not be loaded because the App Transport Security policy requires the use of a secure connectionATS blocked cleartext Meaning
ATS requires HTTPS with modern TLS. Move the server to HTTPS. For development only, add an NSExceptionDomains entry for the specific host in ios/Runner/Info.plist; avoid NSAllowsArbitraryLoads in production because App Review asks for justification.
Common causes
- Calling an http:// URL from iOS
- Server TLS older than 1.2 or weak ciphers
- Redirect to HTTP
- Local dev server by IP
- Third-party SDK using cleartext
⚡ Quick fix
- Use HTTPS with a valid certificate
- Add a domain-specific ATS exception for dev
- Test with
nscurl --ats-diagnostics https://host
Detailed fix by platform
iOS
- Info.plist →
NSAppTransportSecurity→NSExceptionDomains→<host>→NSExceptionAllowsInsecureHTTPLoads = true
How to diagnose
- URL — https?
- TLS — 1.2+?
- Exception — Scoped to the host?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Cleartext HTTP traffic not permitted Flutter (Android): java.io.IOException: Cleartext HTTP traffic to api.example.com not permitted
- CocoaPods: pod install failed / not installed Flutter iOS: Error running pod install — CocoaPods not installed or out of date / [!] CocoaPods could not find compatible versions for pod
- HandshakeException: CERTIFICATE_VERIFY_FAILED Dart: HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate)
Most viewed in Flutter / Dart
- setState() called after dispose() Flutter: setState() called after dispose(): _MyState#1a2b3 (lifecycle state: defunct, not mounted)
- A RenderFlex overflowed Flutter: A RenderFlex overflowed by x pixels on the right/bottom
- Null check operator used on a null value Dart/Flutter: Null check operator used on a null value
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026