-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Description
The Thin Binary
script needs to run before Process Info.plist
.
The Thin Binary
script calls flutter_tools/bin/xcode_backend.dart, which calls a function addObservatoryBonjourService
which adds NSBonjourServices
and NSLocalNetworkUsageDescription
to the plist when in debug mode. If Process Info.plist
is run after it, though, the plist gets regenerated and the added NSBonjourServices
and NSLocalNetworkUsageDescription
will be overwritten.
Steps to Reproduce
flutter create my_app
- Open app in Xcode
- Set Team under Signing & Capabilities
- Run on a physical device through Xcode
- Wait until it's done building and running and then on the device, click Allow to the permission popup
- Click Stop icon in Xcode
- Run on a simulator device through Xcode
- Wait until it's done building and running and then click the Stop icon in Xcode
- Run on same physical device (from step 4) through Xcode
- Click Stop in Xcode
- Run on same physical device (from step 4) through Xcode
- Check Xcode console for mDNS error message
This was reproducible for me every time. There may be other ways to reproduce, but this worked for me. To repeat the process, in Xcode click Product > Clean Build Folder and then do steps 4-11.
You can check to see if it's happening by checking the build log in the Report Navigator in Xcode (see screenshot) and see Process Info.plist
happens after Thin Binary
. You should also see an error message in the Xcode console (see Logs below for expected error message). If running in terminal with flutter run
, you should also expect to see the error message, but won't be able to see the order of events.
Findings
I found the following comment that could be a potential solution: lionheart/openradar-mirror#20408 (comment)
Logs
Logs
2023-01-05 13:27:11.669919-0600 Runner[3923:327476] [VERBOSE-2:FlutterObservatoryPublisher.mm(97)] Failed to register observatory port with mDNS with error -65555.
2023-01-05 13:27:11.669952-0600 Runner[3923:327476] [VERBOSE-2:FlutterObservatoryPublisher.mm(99)] 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
flutter doctor -v
[!] Flutter (Channel unknown, 3.7.0-14.0.pre.13, on macOS 13.1 22C65 darwin-arm64, locale en)
! Flutter version 3.7.0-14.0.pre.13 on channel unknown at xxx
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at
https://flutter.dev/docs/get-started/install.
! Unknown upstream repository.
Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
• Framework revision b938dc13df (3 days ago), 2023-01-02 05:47:23 -0500
• Engine revision 472e34cbbc
• Dart version 3.0.0 (build 3.0.0-76.0.dev)
• DevTools version 2.20.0
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to
perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at xxx
• Platform android-33, build-tools 33.0.0
• ANDROID_SDK_ROOT = xxx
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14B47b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] VS Code (version 1.74.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.56.0
[✓] Connected device (3 available)
xxx
[✓] HTTP Host Availability
• All required HTTP hosts are available