How to detect if Local Network permissions are granted?

With the new Local Network privacy permissions in iOS 14, is there an API for an app to find out if Local Network permissions are granted to the app? Couldn't find anything in my first look through documentation.

Our use case: our app opens a UDP port to listen for 3rd-party devices on the network that use UDP broadcasts.
Experimenting with iOS 14 Beta 2, opening the UDP port does not return any errors; we just don't receive any data sent to that port. This is normal if no device exists, but a problem the user can resolve if the device is broadcasting and the user just needs to grant Local Network access to our app.
We'd like to detect this case and prompt the user to go to Settings and grant access.

EDIT:
I see this question has been asked on the forums already, and there is no API.
https://developer.apple.com/forums/thread/650648
https://developer.apple.com/forums/thread/651107

I'd like to add this use case as an argument to add an API. Without this API, there is no error code or other way our app can tell the difference between "no device broadcasting" and "user needs to grant permission".

Replies

Opened Feedback: FB8081701 (Request iOS 14 API to determine if app has Local Network access granted)
  • + 1

Thanks for sharing - we have the very similar use-case (scan for available hardware which might not be available) and we also worry to handle this properly with the given API. Not having a proper API will just lead to possible obsolete hints in which we link to the settings...
  • 1

My use case is the following. When I establish a Chromecast session and background the app I need to close the connection while the app is backgrounded and re-open it when the app comes back to the foreground.

If the user backgrounds the app, removes the Local Network permission for my app and foregrounds my app, the connection will hang and my app will be in a zombie state where it's waiting for connection and cannot make the decision to play locally because it still thinks it can reach the Chromecast device.

Because we don't know the permission has been denied on foreground, we cannot close the connection that is open right away and clearly communicate to the user that we would need the permission to Cast. Instead we'll keep retrying to connect until the Chromecast SDK times out silently. That may take up to a minute and the user would need to terminate the app to be able to play locally.

If the user continues to use the app in zombie state, after the timeout occurs the previously discovered devices are still cached and selectable because without knowing the permission state we won't know right away the devices became unavailable. If the user attempts to cast to one of the cached devices, we'll re-enter the zombie state without clear communication with the user about what the issue is.

Without an API to check the state of the permission we will have to be guessing and the user may be confused in these use cases above, thereby making our UX far from ideal.

  • 1

Without status check API, we will receive customer complaint.
Post not yet marked as solved Up vote reply of 0x5e Down vote reply of 0x5e
This is also a massive issue for my app which controls 3rd party hardware (Sony cameras to be specific). I cannot rely as someone else said on "Obsolete hints" as my app simply won't function without local network permissions. I have to send UDP discovery packets on the network (Won't work) and then control the cameras either by a socket connection (newer models) or over a local RESTful API (Won't work) once the user is connected. The errors that are returned by the APIs are simply not reliable enough or descriptive enough to get this working, we absolutely need a way to check this (Just as there is with EVERY other privacy setting).
My app listens for UDP streams from games (XBox/PS4) for telemetry - purely one-way traffic. Need to be able to check this permission to generate a phoney request to the network to get the prompt - far from ideal. FB:8449008
We have the same problem like you. In our app, we have configured and Apple granted us to use the com.apple.developer.networking.multicast.

We only need to open and receive UDP broadcast packets, but it doesn't work because the iOS 14 isn't asking/doesn't appear the permission to use Local area network.

How did you do it? @jda-circle