使用Xcode15打包Archive失败,调试正常,Xcode14.2无此问题
问题描述
使用Xcode15执行Archive打包时失败,但在iPhone真机调试运行正常;Xcode14.2下无此问题。
核心错误日志:
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/sword/Library/Developer/Xcode/DerivedData/mage-ios-dsifsnvwvxethjewoknlrdvajlxe/Build/Intermediates.noindex/ArchiveIntermediates/RENPHO/IntermediateBuildFilesPath/MageFitness.build/Release-iphoneos/AI\ Gym.build/Script-23112B16D73A4B02959D4FE9.sh(来自项目'MageFitness'的目标'AI Gym') cd /Users/sword/Desktop/aigym/MageFitness /bin/sh -c /Users/sword/Library/Developer/Xcode/DerivedData/mage-ios-dsifsnvwvxethjewoknlrdvajlxe/Build/Intermediates.noindex/ArchiveIntermediates/RENPHO/IntermediateBuildFilesPath/MageFitness.build/Release-iphoneos/AI\\ Gym.build/Script-23112B16D73A4B02959D4FE9.sh mkdir -p /Users/sword/Library/Developer/Xcode/DerivedData/mage-ios-dsifsnvwvxethjewoknlrdvajlxe/Build/Intermediates.noindex/ArchiveIntermediates/RENPHO/BuildProductsPath/Release-iphoneos/AI Gym.app/Frameworks 已创建符号链接... rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AWSCore.framework" "/Users/sword/Library/Developer/Xcode/DerivedData/mage-ios-dsifsnvwvxethjewoknlrdvajlxe/Build/Intermediates.noindex/ArchiveIntermediates/RENPHO/InstallationBuildProductsLocation/Applications/AI Gym.app/Frameworks" 正在构建文件列表... rsync: link_stat "/Users/sword/Desktop/aigym/MageFitness/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AWSCore.framework" 失败:没有该文件或目录 (2) 完成 已发送29字节 已接收20字节 传输速率98.00字节/秒 总大小为0 加速比为0.00 rsync错误:部分文件无法传输(错误码23),位于/AppleInternal/Library/BuildRoots/d9889869-120b-11ee-b796-7a03568b17ac/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9] Command PhaseScriptExecution 以非零退出码失败
解决方案
1. 更新CocoaPods版本
Xcode15调整了构建路径逻辑,旧版CocoaPods存在兼容问题。执行以下命令更新:
sudo gem install cocoapods
更新后删除项目目录下的Pods文件夹、Podfile.lock,重新执行:
pod install
2. 修改Podfile适配构建路径
在Podfile末尾添加以下配置,强制统一Release模式的构建路径:
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if config.name == 'Release' config.build_settings['BUILD_DIR'] = '$(_BUILD_DIR)' config.build_settings['BUILD_ROOT'] = '$(_BUILD_ROOT)' end end end end
添加后执行pod install,再尝试Archive打包。
3. 调整Xcode项目构建设置
打开Xcode,选中目标AI Gym,进入Build Settings:
- 搜索
Build Locations,将Per-configuration Build Products Path设置为$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) - 执行
Cmd+Shift+K清理项目,删除DerivedData目录后重新Archive。
4. 更新AWSCore依赖版本
确认AWSCore的Pod版本是否支持Xcode15,若版本过旧,在Podfile中指定最新兼容版本后执行:
pod update AWSCore
内容的提问来源于stack exchange,提问作者Sword
相关产品推荐
相关产品推荐

