You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ionic Capacitor+React项目Xcode Archive失败:PhaseScriptExecution非零退出码

Xcode归档失败:Capacitor.framework找不到导致rsync错误

问题概况

  • 未修改项目代码,但Xcode打包归档时持续报错
  • 其他开发者使用相同代码可正常完成归档
  • 已尝试操作:重装Capacitor、重建Pods、重新生成iOS项目文件、卸载重装Xcode,问题未解决

错误日志

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh (in target 'App' from project 'App')
    cd /Users/[USER_NAME]/Desktop/Workspace/[APP_NAME]/ios/App
    /bin/sh -c /Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh

mkdir -p /Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/App.app/Frameworks
Symlinked...
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Capacitor.framework" "/Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app/Frameworks"
building file list ... rsync: link_stat "/Users/[USER_NAME]/Desktop/Workspace/[APP_NAME]/ios/App/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Capacitor.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

解决方案

  • 确认打开的是项目的.xcworkspace文件而非.xcodeproj,Pods依赖仅在Workspace中生效
  • 检查Podfile配置,确保Capacitor被正确添加到目标target,且未被限定在Debug环境:
    target 'App' do
      use_frameworks!
      pod 'Capacitor'
      # 其他依赖...
    end
    
  • 同步Pod版本:复制其他正常工作的Podfile.lock到本地,执行pod install确保依赖版本完全一致
  • 修正Build Settings中的路径配置:
    1. 打开Xcode,进入项目的Build Settings页面
    2. 搜索Uninstalled Products Location,确认Release-iphoneos环境下的路径为$(BUILD_DIR)/UninstalledProducts/$(PLATFORM_NAME)
  • 强制清理并重建:
    # 删除DerivedData缓存
    rm -rf ~/Library/Developer/Xcode/DerivedData
    # 进入iOS目录
    cd ios
    # 移除Pods集成
    pod deintegrate
    # 重新安装Pods
    pod install
    # 先执行Release编译,确认框架生成
    xcodebuild -workspace App.xcworkspace -scheme App -configuration Release-iphoneos build
    
  • 检查Capacitor.framework是否生成:编译完成后,手动前往~/Library/Developer/Xcode/DerivedData/[你的项目]/Build/Intermediates.noindex/UninstalledProducts/iphoneos/目录,确认Capacitor.framework存在

内容的提问来源于stack exchange,提问作者Federico Giorgio Salani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 14:43:10