问题和简介
用XCode16新建的新工程,Object-C和Swift都一样,当用Pod引入一些第三方库后,出现以下错误。
SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a'; try increasing the minimum deployment target
错误原因
这些第三方库,最低支持的版本比较低,比如iOS8,iOS10之类的。但是,高版本的XCode,要求最低支持版本不能太低,所以提示提高最低支持版本的设置。try increasing the minimum deployment target
脚本方案
因为是CocoaPods管理的第三方库的最低支持版本,所以,通过在Podfile中用脚本统一修改是最能想到的解决方法
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "16.0"
end
end
end
- 本来这样处理一直是好的,但是最近这个方案在最新的XCode16之后,🈶出现了新问题:
Framework 'AFNetworking' not found
Linker command failed with exit code 1 (use -v to see invocation)
大致的意思就是link的时候,找不到framework的位置,至于是哪个三方库,提示信息中会随机出现。
手动设置
不用Podfile的脚本,而是直接选中Pod工程,进行手动设置,这个问题就没了。原因不明,就像玄学一样,无法解释。
手动修改版本号
小结
- Podfile中除了列三方库名字,尽量别加其他脚本
- 考虑用SPM替换CocoaPods