Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

iOS app cannot load an http:// URL because App Transport Security blocks it

ErrorApp Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

Short answer

App Transport Security (ATS) makes every URLSession request use HTTPS with a modern TLS setup. An http:// URL, or an https:// server that fails the extra checks, is refused. The best fix is to serve the API over HTTPS. If you cannot, add an exception for that one domain in Info.plist, not a global switch.

  • Applies to Xcode 26, iOS 26, macOS 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run Apple's nscurl diagnostics against the server you call. It tries the default ATS rules and then combinations of exceptions, and prints PASS or FAIL for each, so you see whether the problem is the http:// scheme or the server's TLS setup.

    /usr/bin/nscurl --ats-diagnostics --verbose https://api.example.com
  2. 2Match what you see, then jump to its fix

    1. 1The console line says ATS blocked a cleartext HTTP (http://) resource loadThe URL starts with http://Fix
    2. 2The same ATS message, for a single third-party hostOne server you do not control only speaks HTTPFix
    3. 3An https:// URL is refused, and in nscurl the default test fails while the Allow All Loads test passesThe https:// server fails ATS's extra security checksFix
    4. 4The failing request comes from WKWebView content or AVFoundation playback, while normal API calls workOnly a web view or media player needs insecure loadsFix

What does the error look like?

  • App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

Cause 1 of 4

The URL starts with http://

1Check

Find the URL the request used. ATS applies to HTTP connections made through the URL Loading System, usually URLSession, and it requires HTTPS.

grep -rn "http://" --include=*.swift --include=*.plist .

2Fix

Change the URL to https:// and make sure the server answers on HTTPS. Apple says to improve the server first and only then think about exceptions.

// before
let url = URL(string: "http://api.example.com/v1/items")!
// after
let url = URL(string: "https://api.example.com/v1/items")!

3Verify

Run the app again and repeat the request. The ATS line no longer appears in the console.

curl -I https://api.example.com/v1/items

Confirmed by developer.apple.com

Did this fix it?

Cause 2 of 4

One server you do not control only speaks HTTP

1Check

Confirm that the host really has no HTTPS endpoint, for example with the nscurl command above. If an https:// version passes, use it instead.

/usr/bin/nscurl --ats-diagnostics https://legacy.example.com

2Fix

Add a per-domain exception under NSAppTransportSecurity > NSExceptionDomains in Info.plist, with NSExceptionAllowsInsecureHTTPLoads set to true. Add NSIncludesSubdomains only if subdomains need it. Apple expects exceptions to be as narrow as possible, and the insecure-HTTP key needs a justification in App Store review.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>legacy.example.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>

3Verify

Clean build, run again and request the same URL. It now loads.

# Xcode: Product > Clean Build Folder, then run the app

Confirmed by developer.apple.com

Did this fix it?

Cause 3 of 4

The https:// server fails ATS's extra security checks

1Check

ATS wants TLS 1.2 or later, forward secrecy through ECDHE, SHA-256 or stronger certificate digests, and RSA 2048 or ECC 256 keys. Read the nscurl results to see which exception makes the test pass.

/usr/bin/nscurl --ats-diagnostics --verbose https://api.example.com

2Fix

Reconfigure the server for the failing requirement (for example enable ECDHE ciphers if turning off forward secrecy made the test pass). Only if you cannot, add the matching exception key for that domain, such as NSExceptionRequiresForwardSecrecy.

<key>NSExceptionDomains</key>
<dict>
    <key>api.example.com</key>
    <dict>
        <key>NSExceptionRequiresForwardSecrecy</key>
        <false/>
    </dict>
</dict>

3Verify

Run nscurl again: the Default ATS Secure Connection test passes.

/usr/bin/nscurl --ats-diagnostics https://api.example.com

Confirmed by developer.apple.com

Did this fix it?

Cause 4 of 4

Only a web view or media player needs insecure loads

1Check

ATS has separate global keys for web content and for AVFoundation, so you do not need to switch ATS off for the whole app.

grep -rn "WKWebView\|AVPlayer" --include=*.swift .

2Fix

Set NSAllowsArbitraryLoadsInWebContent (web views) or NSAllowsArbitraryLoadsForMedia (AVFoundation) to true instead of NSAllowsArbitraryLoads. Both need a justification in App Store review.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>

3Verify

Load the page or media again. Normal URLSession calls to http:// are still blocked, which is the point.

# run the app and open the web view or player

Confirmed by developer.apple.com

Did this fix it?

How do I stop it coming back?

  • Serve every API over HTTPS with TLS 1.2 or later and ECDHE ciphers before the app ships.
  • Keep ATS exceptions per domain, and write down why each one exists for App Review.
  • Run nscurl --ats-diagnostics against each new backend host as part of setup.
  • Use URLSession rather than lower-level networking, because ATS only covers the URL Loading System.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Mobile apps

App record creation fails because you lack permission

You cannot add a new app in App Store Connect as a Developer or limited user

Only the Account Holder, an Admin or an App Manager can create an app record, and Apple blocks it until the Account Holder has signed the latest agreement.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.