升级Xcode 14.3之前,Debug 和 Archive 都没问题;升级 Xcode 14.3之后,Debug 没问题,Archive 就报错。错误信息如下:
building file list ... rsync: link_stat "/Users/xxx/.../AFNetworking.framework" failed: No such file or directory (2)
done
sent 29 bytes received 20 bytes 98.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/9e200cfa-7d96-11ed-886f-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code
解决
搜索Xcode 14.3 Archive failure when running Cocoapods build script phase
,可以看到CocoaPods已有issue在Xcode 14.3 beta时就有人发现了,结果Xcode 14.3正式版还是有问题。。。解决方案如下:
- 假如电脑上还有Xcode 14.2,则把
Command Line Tools
中改为Xcode 14.2编译,如下图:
- 如果使用 Xcode Cloud有问题,可以修改Xcode Version为Xcode 14.2, 如下图:
- 假如电脑上只有一个最新的Xcode 14.3,比如我。。。
- 那么要如下修改:
找到...-frameworks.sh 文件,替换
source="$(readlink "${source}")"
为
source="$(readlink -f "${source}")"
很简单对吧,问题是,这个...-framework.sh在哪?我也不知道。
做法是:全局搜要替换的这段`source="$(readlink "${source}")"`,然后再把它替换为正确的`source="$(readlink -f "${source}")"`,再次编译即可成功。
- 修改podfile文件
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
shell_script_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"
if File::exists?(shell_script_path)
shell_script_input_lines = File.readlines(shell_script_path)
shell_script_output_lines = shell_script_input_lines.map { |line| line.sub("source=\"$(readlink \"${source}\")\"", "source=\"$(readlink -f \"${source}\")\"") }
File.open(shell_script_path, 'w') do |f|
shell_script_output_lines.each do |line|
f.write line
end
end
end
end
end
再次执行pod install
即可。
网友评论