DEV Community

Cover image for [HowTo] enable Local Network Privacy Permissions on iOS14+
Passakorn Choosuk
Passakorn Choosuk

Posted on

[HowTo] enable Local Network Privacy Permissions on iOS14+

[Problem]

After trying to launch my-flutter-app on iOS14 iPhone, then it displayed an issue about Failed to register observatory port with mDNS. This is the full error message in the console

[VERBOSE-2:FlutterObservatoryPublisher.mm(101)] Failed to register observatory port with mDNS with error -65555.
[VERBOSE-2:FlutterObservatoryPublisher.mm(103)] On iOS 14+, local network broadcast in apps need to be declared in the app's Info.plist. Debug and profile Flutter apps and modules host VM services on the local network to support debugging features such as hot reload and DevTools. To make your Flutter app or module attachable and debuggable, add a '_dartobservatory._tcp' value to the 'NSBonjourServices' key in your Info.plist for the Debug/Profile configurations. For more information, see https://flutter.dev/docs/development/add-to-app/ios/project-setup#local-network-privacy-permissions

[Solution]

From the link above, we just follow the instruction and the problem will be solved.
1 Rename Info.plist to Info-Debug.plist and copy this file to create a new file called Info-Release.plist
Image description

2 Open Runner.xcworkspace with Xcode and remove Info.plist then add Info-Debug.plist and Info-Release.plist
Image description

3 Add key NSBonjourServices with value _dartobservatory._tcp
Image description

4 Change Info.plist file to Runner/Info-$(CONFIGURATION).plist from Runner/Info.plist
Image description

5 Delete Info-Release.plist in Build Phase menu
Image description

6 Run the app again and there is no compliant about local network permission anymore

Top comments (0)