Failed to register observatory port with mDNS with error -65555.

flutter項目,通過xcode真機(jī)運(yùn)行報錯如下:

問題 :futter iOS 14.0 build error :

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. For more information, see https://flutter.dev/docs/development/add-to-app/ios/project-setup#local-network-privacy-permissions

解決:(參考上述官方鏈接文檔)

On iOS 14 and higher, enable the Dart multicast DNS service in the Debug version of your app to add?debugging functionalities such as hot-reload and DevTools?via?flutter attach.

1、將應(yīng)用程序的Info.plist重命名為Info-Debug.plist。復(fù)制一個名為Info-Release.plist的副本,并將其添加到Xcode項目中。

2、在Info-Debug.plist中,添加鍵NSBonjourServices并將值設(shè)置為?_dartobservatory._tcp ?

(可選)將鍵NSLocalNetworkUsageDescription添加到所需的自定義權(quán)限對話框文本中。(備注:‘Allow Flutter tools on your computer to connect and debug your application.This prompt will not appear on release builds.’)

3、在target’s build settings, 修改?Info.plist File?路徑 path/to/Info.plist 為 path/to/Info-$(CONFIGURATION).plist.

4、在?target’s ->?Build Settings > Build Phases > Copy Bundle?Resources build phase, 如果有Info-Release.plist?刪除即可(下圖我已經(jīng)刪除)

補(bǔ)充:

如果再次運(yùn)行還有次問題,clean項目,重新運(yùn)行即可。歡迎補(bǔ)充??

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容