执行flutter run在实体iPhone运行时遇iOS构建失败求助
解决Flutter运行到iPhone时Xcode构建失败(resultBundlePath文件已存在)
问题重现
执行flutter run将Flutter应用部署到实体iPhone时,出现以下报错:
Automatically signing iOS for device deployment using specified development team in Xcode project: U82S29GYHT Xcode build failed due to concurrent builds, will retry in 2 seconds. Running Xcode build... Xcode build done. 113.8s Failed to build iOS app Could not build the precompiled application for the device. Error output from Xcode build: ↳ 2023-08-08 21:56:45.845 xcodebuild[60532:459242] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter xcodebuild: error: Existing file at -resultBundlePath "/var/folders/qc/r59z7mgx0v18zk6397764cz00000gn/T/flutter_tools.JRawz4/flutter_ios_build_temp_dir5qvG7L/temporary_xc result_bundle.xcresult"
解决方案
清理项目构建缓存
- 终端进入项目根目录,执行:
flutter clean - 进入iOS子目录:
cd ios,执行:pod deintegrate && pod install
- 终端进入项目根目录,执行:
删除Xcode临时构建文件
- 直接删除报错中指定的已存在文件:
rm -rf "/var/folders/qc/r59z7mgx0v18zk6397764cz00000gn/T/flutter_tools.JRawz4/flutter_ios_build_temp_dir5qvG7L/temporary_xcresult_bundle.xcresult" - 或者清理Xcode的Derived Data:打开Xcode →
Xcode > Settings > Locations,点击Derived Data路径旁的箭头,删除文件夹内所有内容
- 直接删除报错中指定的已存在文件:
终止残留进程并重启构建
- 关闭Xcode和当前终端窗口
- 执行命令杀掉所有xcodebuild进程:
killall xcodebuild - 重新打开终端,进入项目目录执行
flutter run
检查版本兼容性
- 升级Flutter到稳定版:
flutter channel stable && flutter upgrade - 确保Xcode版本与当前Flutter版本兼容(可通过
flutter doctor检查版本匹配情况)
- 升级Flutter到稳定版:
原因说明
这个错误主要是前一次构建中断后,Flutter生成的临时构建结果文件未被自动清理,导致后续Xcode构建时无法创建同名文件;而IDEResultKitSerializationConverter的警告多为Xcode与Flutter工具链的小版本兼容问题,清理缓存和临时文件后通常会自动消失。
内容的提问来源于stack exchange,提问作者Winston T.
相关产品推荐
相关产品推荐

