Search code examples
iosswiftxcodeios14mdns

Test Flight - Local Network permission, NSBonjourServices error in TestFlight build


For iOS14 we are supposed to get the local network permission from the user. The app works fine if I run directly on the device or export it as an Enterprise application. If I upload the same app to Test flight I am getting the following error.

App Info.plist(NSBonjourServices) does not allow '_xxx-xxx-config._tcp.' for (Lhoapp)

What is this error? How to fix this?

In Info.plist I have added the following services used in app:

<key>NSBonjourServices</key>
    <array>
        <string>_xxx-xxx-config._tcp</string>
        <string>_iri._tcp</string>
    </array>

I am getting the following errors in the log

["NSNetServicesErrorDomain": 10, "NSNetServicesErrorCode": -72008]

I have enabled the Local network permission under privacy for the app


Solution

  • Apple document indicates that for NSLocalNetworkUsageDescription

    Any app that uses the local network, directly or indirectly, should include this description. This includes apps that use Bonjour and services implemented with Bonjour, as well as direct unicast or multicast connections to local hosts.

    Then you need to add NSLocalNetworkUsageDescription And your plist should be like this, of course change your app name and tcp.

    <key>NSLocalNetworkUsageDescription</key>
    <string>Exchange data with nearby devices running the Yourapp.</string>
    <key>NSBonjourServices</key>
    <array>
        <string>_yourApp._tcp</string>
    </array>