在安卓进行插件调试很顺利,但是在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,问题完美解决。