2024-06-15 Flutter 插件项目 flutter attach 卡在Waiting for a connection from Flutter on xxx...

在安卓进行插件调试很顺利,但是在iOS端,有时可以,有时一直等待,十分影响开发效率。网上找了很多方法,最终也还是没有解决,今天在调试插件启动日志时,发现了如下提示:

[VERBOSE-2:FlutterDartVMServicePublisher.mm(124)] 
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 '_dartVmService._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

很好,之前官网上并没有提到需要加 _dartVmService 这个值,只是提到加_bonjour._tcp,于是果断在NSBonjourServices 再添加_dartVmService,问题完美解决。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。