升级Xcode16与iOS18后Flutter iOS项目编译失败求助
Flutter升级Xcode和macOS后iOS编译失败问题
升级Xcode和macOS后,无法在iOS设备或模拟器上编译Flutter应用,每次执行flutter run时报错内容都会变化,以下是某次终端输出的错误信息:
Uncategorized (Xcode): Command SwiftGeneratePch emitted errors but did not return a nonzero exit code to indicate failure Error (Xcode): no such file or directory: '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation' Error (Xcode): stat cache file '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator18.0-22A3362- db63dc9361471f152f572502bdbfe70a.sdkstatcache' not found Error (Xcode): unable to rename temporary '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3F9VRK3CXAUUD/UIKit-1KHQ7M05IF VXC-56601391.pcm.tmp' to output file '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3F9VRK3CXAUUD/UIKit-1KHQ7M05IF VXC.pcm': 'No such file or directory' Error (Xcode): could not build module 'UIKit' /Users/chiragbhansali/Chirag/Coding/Projects/app/test/build/ios/Debug-iphonesimulator/Flutter.framewo rk/Headers/FlutterAppDelegate.h:7:8 Error (Xcode): could not build module 'Flutter' /Users/chiragbhansali/Chirag/Coding/Projects/app/test/ios/Runner/GeneratedPluginRegistrant.h:9:8 Error (Xcode): failed to emit precompiled header '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/Runner-eifcguceazlwumgsyzegclqdrbqt/Build/Intermed iates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_PB6A5GFLTNPC-clang_3F9VRK3CXAUUD.pch' for bridging header '/Users/chiragbhansali/Chirag/Coding/Projects/app/test/ios/Runner/Runner-Bridging-Header.h' Uncategorized (Xcode): Command PrecompileSwiftBridgingHeader emitted errors but did not return a nonzero exit code to indicate failure Uncategorized (Xcode): Command SwiftEmitModule failed with a nonzero exit code Uncategorized (Xcode): Command SwiftCompile failed with a nonzero exit code Could not build the application for the simulator. Error launching application on iPhone 16 Pro.

已尝试的解决方法
- 删除iOS SDK和模拟器
- 使用
cmd+shift+k清理Xcode构建缓存 - 创建新Flutter项目尝试编译(同样失败,排除Flutter自身问题)
- 清空DerivedData文件夹
- 清空模拟器设置与缓存
- 重启笔记本电脑
版本信息
- Xcode: 16.0
- iOS: 18.0
- macOS: 15.1(15.0版本时同样无法编译)
- Flutter: 3.24
内容的提问来源于stack exchange,提问作者Chirag Bhansali
相关产品推荐
相关产品推荐

