This post is part of the Local Network Privacy FAQ.
How do I tell whether I’ve been granted local network access?
There is no API that directly returns your local network access state (r. 69157424).
There are, however, a number of techniques you can apply:
-
If you’re using Bonjour, you will get the
kDNSServiceErr_PolicyDenied
(-65570) error if your Bonjour operation failed because you don’t have local network access. -
If your goal is to connect to a local network address using
NWConnection
then, starting with iOS 14.2 beta, you can use the unsatisfied reason property. See Local Network Privacy FAQ-10 for details.
If the above don’t meet your requirements, you should file an enhancement request describing those requirements.