1.三方庫支持的iOS版本過低
報錯信息:
The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.4.99.
這個錯誤在Xcode14.2及早期版本是以警告的方式提醒,升級到14.3后就直接報錯了,解決方法將支持目標版本提高到最低支持版本,如下圖,我的Xcode上編譯最低需要支持iOS11:
image.png
具體操作:
1.修改每個三方庫支持的版本最低為Xcode編譯需要的版本,這個方法太繁瑣,且每次pod install
后需要重新修改,不建議該方法。
2.修改pod文件,在pod文件末尾加上如下:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 11.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
end
end
上述代碼表示:將支持小于iOS11的三方庫,都修改為iOS11。
2.Archive打包時出錯
報錯信息:
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/c2cb9645-dafc-11ed-aa26-6ec1e3b3f7b3/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code
查找修改文件方法:
1.pod -> Targets Support Files -> Pods-TargetName-frameworks.sh -> source="$(readlink "${source}")"
。
2.全局搜索readlink
。
修改:
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")" // 修改前
source="$(readlink -f "${source}")" // 修改后
fi
需要注意的是,后續項目每次pod install
之后,都要再進行修改。