Flutter运行Ios真机时报错:Failed to register observatory port with mDNS with error

4 篇文章 0 订阅

Flutter运行Ios真机时报错:Failed to register observatory port with mDNS with error

报错如下

[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.

在这里插入图片描述

解决:(参考上述官方链接文档)

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、将应用程序的Info.plist重命名为Info-Debug.plist。复制一个名为Info-Release.plist的副本,并将其添加到Xcode项目中。
    在这里插入图片描述

  • 2、在Info-Debug.plist中,添加键NSBonjourServices并将值设置为 _dartobservatory._tcp

(可选)将键NSLocalNetworkUsageDescription添加到所需的自定义权限对话框文本中。(备注:‘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 删除即可(下图我已经删除)
    在这里插入图片描述

参考

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值