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

Ionic Capacitor项目iOS归档时[CP] Embed Pods Frameworks执行失败求助

解决Capacitor Ionic项目iOS归档失败问题

问题场景

维护一个同时支持iOS和Android平台的Capacitor Ionic项目,本地构建、设备真机运行均正常,但执行Xcode归档操作时失败,报错信息如下:

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks 
/Users/fabus/Library/Developer/Xcode/DerivedData/App-gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh (in target 'App' from project 'App')
cd /Users/fabus/Development/showmaker/showmaker_festivals/ios/App     
/bin/sh -c /Users/fabus/Library/Developer/Xcode/DerivedData/App-gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh
mkdir -p /Users/fabus/Library/Developer/Xcode/DerivedData/App-gkhellzebxgrxeeuozvkjsnejnul/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/fabus/Library/Developer/Xcode/DerivedData/App-gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app/Frameworks"
building file list ... rsync: link_stat "/Users/fabus/Development/showmaker/showmaker_festivals/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/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9] Command PhaseScriptExecution failed with a nonzero exit code

Pods依赖配置

当前项目的Podfile依赖如下:

pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser'
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network'
pod 'CapacitorPushNotifications', :path => '../../node_modules/@capacitor/push-notifications'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
pod 'CordovaPluginsStatic', :path => '../capacitor-cordova-ios-plugins'

已尝试的无效操作

  • 在iOS目录执行pod deintegrate和pod update
  • 清理Xcode Build文件夹(Shift+Command+K)
  • 确认项目名称无特殊字符或空格
  • 更新并导入所有开发者证书至Xcode
  • 重启电脑和Xcode
  • 勾选Build Phases(Targets > App > Build phases)中[CP] Embed Pods Frameworks的“For install build only”选项
  • 确认近期未修改capacitor.config、package.json等核心构建文件

更新错误信息

手动执行报错的Shell脚本时,输出路径缺失错误:

/Users/fabus/Library/Developer/Xcode/DerivedData/App-gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh: line 2: /Target Support Files/Pods-App/Pods-App-frameworks.sh: No such file or directory

解决方案

1. 彻底重建Pods依赖

脚本路径错误通常是Pod配置未正确生成导致,按以下步骤操作:

  • 完全关闭Xcode
  • 在项目iOS目录执行:
    pod deintegrate
    rm -rf Podfile.lock Pods
    pod install
    
  • 打开生成的App.xcworkspace文件(必须用xcworkspace,不能用xcodeproj)

2. 修正Embed Pods脚本路径

进入Targets > App > Build Phases,找到[CP] Embed Pods Frameworks脚本:

  • 检查脚本第二行的source路径,确保是基于${PODS_ROOT}的相对路径,正确格式应为:
    source "${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh"
    
  • 若路径为绝对路径或缺失${PODS_ROOT},手动修正为上述格式

3. 清理DerivedData缓存

  • 打开Xcode偏好设置 → Locations → DerivedData,点击右侧箭头打开文件夹
  • 删除当前项目对应的DerivedData文件夹(即App-gkhellzebxgrxeeuozvkjsnejnul)
  • 重启Xcode后重新执行归档操作

4. 校验Capacitor版本一致性

检查package.json中Capacitor相关依赖版本是否统一:

  • 确保@capacitor/core、@capacitor/ios及所有Capacitor插件版本完全匹配
  • 若版本不一致,执行以下命令更新:
    npm update @capacitor/core @capacitor/ios @capacitor/app @capacitor/browser @capacitor/haptics @capacitor/keyboard @capacitor/network @capacitor/push-notifications @capacitor/splash-screen @capacitor/status-bar
    npx cap sync ios
    
  • 再次执行pod install后尝试归档

内容的提问来源于stack exchange,提问作者Fabus

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 23:25:18