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

使用CocoaPods时Xcode 14.3项目归档失败求助

iOS项目使用CocoaPods归档失败问题

报错信息

sync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework" "/[AppPath]/Build/Intermediates.noindex/ArchiveIntermediates/QA/InstallationBuildProductsLocation/Applications/[APP NAME].app/Frameworks"
building file list ... rsync: link_stat "/[APP_PATH]../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.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

环境信息

  • MacBook: M1 Macbook Pro
  • MacOS: Ventura 13.2.1
  • Xcode版本: 14.3
  • Pods版本: 1.12.0

Podfile内容

# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'

target '[APP NAME]' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  pod 'Moya', '~> 14.0.0'
  pod 'Moya/RxSwift',' ~> 14.0.0'
  pod 'Eureka'
  pod 'SwiftSignalRClient'
  
  pod 'Kingfisher'
  #pod 'FMPhotoPicker', '~> 1.3.0'
  
  pod 'iOSDropDown'
  
  #Material TextFields
  pod 'MaterialComponents/TextControls+OutlinedTextAreas'
  pod 'MaterialComponents/TextControls+OutlinedTextFields'
  
  pod 'Blueprints'

  pod 'PhoneNumberKit'
  
  pod 'Firebase/Analytics'
  pod 'Firebase/Crashlytics'
  pod 'FirebaseMessaging'
  pod 'FittedSheets'


post_install do |installer|
      installer.generated_projects.each do |project|
            project.targets.each do |target|
                target.build_configurations.each do |config|
                    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
                 end
            end
     end
  end

end

问题补充

通过Xcode包管理器添加依赖时归档成功,但使用CocoaPods管理依赖时归档失败。


解决方案

1. 更新CocoaPods版本

CocoaPods 1.12.0与Xcode 14.3存在路径拼接的兼容性问题,更新到最新稳定版本可修复该问题:

sudo gem install cocoapods

更新后执行以下命令重置Pods:

pod deintegrate
pod install

2. 修改Podfile的post_install脚本

在现有脚本中添加适配Xcode 14+的构建设置,修复框架路径问题:

post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
        # 开启框架分发构建,适配Xcode 14+路径逻辑
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
      end
    end
  end
  # 针对Pods项目修复架构设置
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if Gem::Version.new('14.0') <= Gem::Version.new(Xcode::Version.current)
        config.build_settings['ARCHS'] = ['$(ARCHS_STANDARD)']
      end
    end
  end
end

修改后执行pod install,再尝试归档。

3. 调整Xcode归档相关设置

  • 打开Pods项目的Build Settings,搜索Skip Install,将所有Pods target的该选项设置为NO
  • 确保主项目的Skip Install设置为YES
  • 清理构建缓存:执行Cmd+Shift+K清理构建产物,再执行Cmd+Option+Shift+K清理DerivedData
  • 重新尝试归档操作

4. 手动验证框架路径

报错显示路径拼接错误/[APP_PATH]../../../,可手动验证框架位置:

  • 打开Xcode偏好设置→Locations,查看DerivedData路径
  • 检查该路径下IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework是否存在
  • 若不存在,执行pod build重新构建Pods框架

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 00:05:00