The same error is also triggered setting up Multipeer Connectivity (which uses Bonjour). The code I was using for initiating Bonjour browsing and Multipeer Connectivity was modified from the Apple sample code and worked fine under iOS 13.
You need to add the following keys to the Info.plist: NSLocalNetworkUsageDescription and NSBonjourServices. E.g.
<key>NSLocalNetworkUsageDescription</key>
<string>Reason for using Bonjour that the user can understand</string>
<key>NSBonjourServices</key>
<array>
<string>_my-service._tcp</string>
<string>_my-service._udp</string>
</array>
Ensure that my-service is correctly named for your service name. E.g. if your are setting up MPC for a "foobar" service, you might have
mpcAdvertiserAssistant = MCAdvertiserAssistant(serviceType: "foobar", discoveryInfo: discoveryInfoDict, session: mpcSession)
and so you would use
<string>_foobar._tcp</string>
<string>_foobar._udp</string>
(You might not require both TCP and UDP in your implementation.)
See https://developer.apple.com/videos/play/wwdc2020/10110/
and https://developer.apple.com/forums/thread/653316
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With