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

Azure CI/CD执行Swift项目Firebase Crashlytics脚本失败求助

Swift项目Azure CI/CD流水线Firebase Crashlytics脚本执行失败问题

问题详情

我是Azure CI/CD Pipeline新手,正在为Swift项目搭建流水线,但执行Firebase Crashlytics相关Run Script时失败。

关联Run Script代码

if [ "${CONFIGURATION}" = "Release" ]; then
"${PODS_ROOT}/FirebaseCrashlytics/run"
fi

Azure Pipeline YML配置

# Xcode
# Build, test, and archive an Xcode workspace on macOS.
# Add steps that install certificates, test, sign, and distribute an app, save build artifacts, and more:

trigger:
- development

pool:
  vmImage: 'macos-latest'

pr:
  branches:
    include:
      - develop
  paths:
    include:
      - ProjectName/*

steps:
- task: Cache@2
  inputs:
    key: 'pods | "$(Agent.OS)" | Podfile.lock'
    path: 'Pods'
    cacheHitVar: 'PODS_CACHE_RESTORED'
- task: CocoaPods@0
  displayName: 'pod install using the CocoaPods task with defaults'
  condition: ne(variables.PODS_CACHE_RESTORED, 'true')

- task: Xcode@5
  inputs:
    actions: 'build'
    scheme: ''
    sdk: 'iphoneos'
    configuration: 'Release'
    xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace'
    xcodeVersion: 'default'
- task: Xcode@5
  displayName: 'Build and Sign'
  inputs:
    actions: 'build'
    sdk: '$(sdk)'
    scheme: '$(scheme)'
    signingOption: 'auto'
    teamId: $(teamId)
    packageApp: false
    destinationPlatformOption: 'ios'
    configuration: '$(configuration)'
    xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace'
    xcodeVersion: 'default'
    args: '-derivedDataPath $(build.Repository.LocalPath)/xxxx/'

报错信息

执行脚本时提示找不到文件:error: No such file or directory: '/Users/runner/work/1/s/Pods/FirebaseCrashlytics/run'


修复方案

  1. 验证Pods安装完整性

    • 临时禁用Cache@2任务,强制重新执行pod install,确认Pods/FirebaseCrashlytics/run文件存在。
    • 检查Podfile是否包含pod 'Firebase/Crashlytics',且Podfile.lock已同步提交到代码仓库。
  2. 修正路径变量与工作目录

    • 在Run Script中添加echo "${PODS_ROOT}",输出实际路径,确认是否与流水线工作目录匹配。
    • 为Xcode任务指定workingDirectory参数,设置为项目根目录,确保脚本能正确定位Pods路径。
  3. 合并重复Xcode任务

    • 将两个Xcode@5任务合并为一个,统一配置Release构建、签名参数,避免重复构建导致的上下文混乱。
  4. 调整Build Phases执行顺序

    • 在Xcode项目的Build Phases中,将Firebase Crashlytics的Run Script移至[CP] Embed Pods Frameworks之后执行。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.23 06:45:19