美文网首页
Flutter_local network broadcast

Flutter_local network broadcast

作者: Eyes_cc | 来源:发表于2022-04-30 07:17 被阅读0次

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

在这里插入图片描述
5.2 在Info-Debug.plist中,添加键NSBonjourServices并将值设置为 _dartobservatory._tcp。注意 Xcode 会将其显示为“Bonjour 服务”。

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

5.5 运行启动您的应用程序 flutter run.
或者F5
或者flutter run --release(这个方式只支持真机)
第一次运行可能会报:flutter Errors found! Invalidating cache...
解决: 再次运行即可。

相关文章

网友评论

      本文标题:Flutter_local network broadcast

      本文链接:https://www.haomeiwen.com/subject/fvbaertx.html