升级Xcode 14.3后Flutter应用无法在iOS模拟器运行:缺失指定文件
解决Xcode 14.3升级后Flutter在iOS15模拟器编译失败的问题
问题现象
升级Xcode到14.3版本后,在iOS15系统的iPhone11模拟器上运行Flutter应用时出现以下报错:
Error (Xcode): File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation) Could not build the application for the simulator.
原因
Xcode 14.3移除了对iOS 14及以下版本的libarclite库支持,如果你的Flutter项目iOS部署目标版本低于15.0,编译时就会找不到该库导致链接失败。
解决方案
方案1:升级iOS部署目标到15.0(推荐)
- 打开项目根目录下的
ios/Podfile文件 - 找到行
platform :ios, 'x.x'(通常是12.0或更低),修改为platform :ios, '15.0' - 执行以下命令更新依赖并重新编译:
cd ios pod deintegrate pod install cd .. flutter clean flutter run
方案2:手动补充libarclite库(适合需保留低部署目标的场景)
- 从Xcode 14.2的安装包中提取
libarclite相关文件,路径为/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/ - 将该目录下的所有文件复制到Xcode 14.3的对应路径
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/ - 复制完成后直接执行
flutter run重新编译
内容的提问来源于stack exchange,提问作者billcyz
相关产品推荐
相关产品推荐

