I'm getting "unsatisfied (Local network prohibited)" when trying accessing my local http server running on mac (http://192.168.0.12:8000/test.txt) from an app running on iPhone with iOS 18.4. That's using URLSession, nothing fancy.
This is the contents of the plist file of the app:
NSAppTransportSecurity
NSExceptionAllowsInsecureHTTPLoads true
NSAllowsArbitraryLoads true
NSAllowsLocalNetworking true
NSExceptionDomains
192.168.0.12
NSIncludesSubdomains true
NSAllowsLocalNetworking true
NSExceptionAllowsInsecureHTTPLoads true
NSLocalNetworkUsageDescription Hello
The app correctly "prompts" the alert on the first app run, asking if I want to access local network, to which I say yes. Afterwards I could see that Local Network is enabled in iOS settings for the app, yet getting those "Local network prohibited" errors.
From testing other global IP + 'http only" sites it feels like NSAllowsArbitraryLoads no longer works as it used to work before. But specifying other test "global" HTTP-only IP addresses in NSExceptionDomains work alright, it's just the local address doesn't.
I could access that IP from iOS safari with no problem. The local web site is HTTP only.
Googling reveals tons of relevant hits including FAQ articles from Quinn, but whatever I tried so far based on those hits doesn't seem to work.
There are two different things in play here:
-
Local network privacy, as explained in TN3179 Understanding local network privacy
It’s easy to tell these apart because they result in different errors:
-
If a request is blocked by ATS you’ll see some some sort of TLS error, typically
NSURLErrorSecureConnectionFailed
(-1200). -
If a request is blocked by LNP you’ll see some other type of transport error, commonly
NSURLErrorNotConnectedToInternet
.
Playing with ATS settings won’t help with an LNP error, and vice versa.
My general advice on the ATS front depends on the final plan for your app:
-
If you plan to deploy a server on the public Internet and only need this for testing, avoid adding an ATS exception. Instead, use the approach described in QA1948 HTTPS and Test Servers.
-
If your app is expected to work with local devices — for example, you’re building an app to configure an accessory — deploy
NSAllowsLocalNetworking
.
The error you’re seeing, Local network prohibited
, is a clear indication of an LNP issue. I’m not 100% sure why you’re hitting it, but I suspect it’s a transient. If you restart your device, does it go away?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"