NSNetServiceBrowser error if permission is not granted

If an app is a client of NSNetServiceBrowser, and attempts to search for services while the local network access permission is not granted for that app, will there be a specific error or notification? Will the app be able to determine the reason why no services were found? Or will this case be undistinguishable, from the app's point of view, from the case where the permission is granted but no services were found on the network?

Replies

The error message you'll see is in this video: https://developer.apple.com/videos/play/wwdc2020/10110/
NWBrowser/nwbrowsert also provides a .waiting state with an error whenever the user has denied local network access.
I realized I made a mistake and never came back to update my reply - the video only applies to NWBrowser, as the Frameworks Engineer above seems to possibly be pointing out as well. There is actually no way for NSNetServiceBrowser to detect this condition.

NSNetServiceBrowserDelegate hits netServiceBrowserWillSearch and then nothing else with local network permission denied.

Is there a way we can just ask the operating system if we have this permission? All I need to do is provide some visual feedback to the user to let them know significant features will be unusable due to this permission being turned off.
Update 2: there is no API to check for the permission:

https://developer.apple.com/forums/thread/650648?page=2

So I'll try to wedge some Swift into our project and start using NWBrowser, I guess.
@Frameworks Engineer

Can we please get an error for NSNetServiceBrowser as well? NWBrowser is iOS13 only, NetServiceBrowser is not deprecated and even got an error if you forgot to setup the stuff in the Info.plist. WHY should it not return an error but NWBrowser does?