处理错误 Xcode 编译找不到文件 libarclite_iphonesimulator.a
<img src="https://ducafecat.oss-cn-beijing.aliyuncs.com/podcast/2023/06/fc2974a96caa626570adbb0b3d46c828.jpeg" style="width:90%;" />
视频
错误描述
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)
<img src="https://ducafecat.oss-cn-beijing.aliyuncs.com/podcast/2023/06/6e8f56e4554fb27fc9a4511101c7a512.png" style="width:90%;" />
分析
libarclite_iphonesimulator.a 这个文件是 ARC 自动释放内存的功能。
引起的问题是你的项目很新,但是编译目标太老,然后呢,没有这个文件。
你需要把这个文件复制到 .../arc/ 目录下。
还有一个办法直接修改 IPHONEOS_DEPLOYMENT_TARGET 编译目标为 ios 11,就好了。这只对新项目有效。
解决
代码方式
ios/Podfile
批量修改所有的依赖项目标版本号
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
# add 修改项目配置
if target.platform_name == :ios
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' # 将11.0替换为您需要的目标版本号
end
end
# add end
end
end
执行命令
$ cd ios
$ pod update
手动方式
手动修改每个依赖包的部署最小版本为 ios 11.0
<img src="https://ducafecat.oss-cn-beijing.aliyuncs.com/podcast/2023/06/a975ac6a003c380a8335357357c5f32b.png" alt="image-20230619161346714" style="zoom:50%;" />
可能遇到的问题
[!] Invalid Podfile file: [!] Specifying multiple post_install hooks is unsupported
这个错误意味着您在 Podfile 文件中指定了多个 post_install
钩子,而 CocoaPods 不支持这种做法。要解决这个问题,您需要将多个 post_install
钩子合并为一个。
© 猫哥
ducafecat.com
end
本文由mdnice多平台发布
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。