flutter iPhone build error

vs code 在 iPhone 编译报错

vs code 在 iPhone 编译 flutter 项目

==  vs code 日志显示 ==

Launching lib/main.dart on Tom iPhone 15 Pro in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: R33E8MCGY3
Xcode build done.                                           19.9s
You may be prompted to give access to control Xcode. Flutter uses Xcode to run your app. If access is not allowed, you can change this through your Settings > Privacy & Security > Automation.
Error connecting to the service protocol: failed to connect to http://127.0.0.1:51379/LJmpI_WqDmI=/

== Xcode 日志显示 == 

NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
flutter: The Dart VM service is listening on http://127.0.0.1:49267/LJmpI_WqDmI=/```

解决办法
fvm flutter clean && fvm flutter pub get && fvm flutter run
删除 APP 重新编译

确保你的 Flutter 应用有正确的网络权限
在 Info.plist 中添加

<key>NSLocalNetworkUsageDescription</key>
<string>用于调试目的</string>
<key>NSBonjourServices</key>
<array>
<string>_dartobservatory._tcp</string>
</array>

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

推荐阅读更多精彩内容