5. 這一步其實是不需要的,可以省略,
Failed to register observatory port with mDNS with error -65555. 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.
5.1 將應(yīng)用程序的Info.plist重命名為Info-Debug.plist。復(fù)制一個名為Info-Release.plist的副本,并將其添加到Xcode項目中。
5.2 在Info-Debug.plist中,添加鍵NSBonjourServices并將值設(shè)置為 _dartobservatory._tcp。注意 Xcode 會將其顯示為“Bonjour 服務(wù)”。
(可選)將鍵NSLocalNetworkUsageDescription添加到所需的自定義權(quán)限對話框文本中。(備注:‘Allow Flutter tools on your computer to connect and debug your application.This prompt will not appear on release builds.’)

5.3 在target’s build settings, 修改 Info.plist File 路徑 path/to/Info.plist 為 Runner/Info-$(CONFIGURATION).plist.
5.4 在 target’s -> Build Settings > Build Phases > Copy Bundle Resources build phase, 如果有Info-Release.plist 刪除即可(下圖我已經(jīng)刪除)
5.5 運行啟動您的應(yīng)用程序
flutter run.或者
F5或者
flutter run --release(這個方式只支持真機)第一次運行可能會報:
flutter Errors found! Invalidating cache...解決: 再次運行即可。