Topics

bonjour broken in iOS 14


Gerriet M. Denkmann
 

This worked up to iOS 13:

let serviceType = "_Gmd-BackGround._tcp."
let parameters = NWParameters()
parameters.includePeerToPeer = true
let browser = NWBrowser(for: .bonjour(type: serviceType, domain: nil), using: parameters )
browser.stateUpdateHandler =
{ (newState: NWBrowser.State) in

print(“\newState”)
}
browser.start(queue: queue)

But in iOS 14 the stateUpdateHandler gets a .failed NWBrowser.State, with DNS Service Error: NoAuth(-65555)

How can this be fixed?

Gerriet.


 



On Sep 18, 2020, at 2:34 AM, Gerriet M. Denkmann <gerriet@...> wrote:

But in iOS 14 the stateUpdateHandler  gets a .failed NWBrowser.State, with DNS Service Error: NoAuth(-65555)

I'm guessing your network environment includes a DNS server that supports DNS updates (i.e. wide-area Bonjour) but you don't have the credentials to push updates to the DNS server.

This error probably only applies to the browser registration for that domain, not for the local-network domain. I.e. your app should still be working for local network browsing.

If you only want to do local-network (mDNS) browsing, then use `domain: "local"` instead of `domain: nil`.

—Jens

Disclaimer: I've never used the "NW" classes, I'm just working off my knowledge of Bonjour.


Gerriet M. Denkmann
 

On 19 Sep 2020, at 01:40, Jens Alfke <jens@mooseyard.com> wrote:

On Sep 18, 2020, at 2:34 AM, Gerriet M. Denkmann <gerriet@mdenkmann.de> wrote:

But in iOS 14 the stateUpdateHandler gets a .failed NWBrowser.State, with DNS Service Error: NoAuth(-65555)
I watched "WWDC 2020 - Support local network privacy in your app” and found out that in iOS 14 the Info.plist needs additional info:

• Privacy - Local Network Usage Description
if not present - then some default is used: “This app will be able to discover and connect to devices on the networks you use"
• Bonjour services
if this is missing, the app gets a .failed NWBrowser.State, with DNS Service Error: NoAuth(-65555)

Also new in iOS 14: waiting: NWError: -65570: PolicyDenied = User has refused access to Local Network


Gerriet.


 



On Sep 18, 2020, at 5:46 PM, Gerriet M. Denkmann <gerriet@...> wrote:

I watched "WWDC 2020 - Support local network privacy in your app” and found out that in iOS 14 the Info.plist needs additional info:

Oh, right! It's the "Access local network" permission. I've seen that pop up.

The Info.plist key must be required only if you build the app against the iOS 14 SDK, right? Otherwise that would break existing apps.

—Jens


Gerriet M. Denkmann
 

On 19 Sep 2020, at 07:51, Jens Alfke <jens@mooseyard.com> wrote:

On Sep 18, 2020, at 5:46 PM, Gerriet M. Denkmann <gerriet@mdenkmann.de> wrote:

I watched "WWDC 2020 - Support local network privacy in your app” and found out that in iOS 14 the Info.plist needs additional info:
Oh, right! It's the "Access local network" permission. I've seen that pop up.

The Info.plist key must be required only if you build the app against the iOS 14 SDK, right? Otherwise that would break existing apps.
Correct. Older apps (build with some SDK < 14) get the default value for "Privacy - Local Network Usage Description” and do not require "Bonjour services” when run in iOS 14.

Gerriet.