iOS 14 Bonjour Dynamic Service Type

I support an app which uses Bonjour for Peer-to-Peer for sharing database information. However, the service type is generated programmatically as only certain device groups are to be allowed to communicate with each other. How should we go about declaring this in our info.plist for Bonjour Services?

How should we go about declaring this in our Info.plist for Bonjour
Services?

You cannot. The Info.plist can only declare a static set of service types. If you don’t have a static set, you’ll need to request the com.apple.developer.networking.multicast entitlement.

Honestly though, I think that a change of tack is in order here. Bonjour service types are arbitrated by IANA so you shouldn’t be generating them dynamically. I recommend that you consider alternative approaches. The two most common are:
  • Embed this identifier in the service name.

  • Lean in to the TXT record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
iOS 14 Bonjour Dynamic Service Type
 
 
Q