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

Expo SDK 50应用在Azure DevOps流水线中iOS构建失败求助

解决Expo SDK 50 + RN 0.73 Azure DevOps iOS手动签名报错问题

核心原因

SDK 50对应React Native 0.73后,CocoaPods的签名策略默认更严格,手动签名时若强制所有target(包括Pods)使用指定配置文件,会触发Pod不支持手动签名的错误,导致xcodebuild退出码65。

解决方案

方案1:修改Podfile,禁止Pods的签名检查

在项目根目录的ios/Podfile末尾添加以下post_install钩子,强制Pods的bundle类型target跳过签名检查:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    # 对所有bundle类型的Pod target禁用签名
    if target.respond_to?(:product_type) && target.product_type == "com.apple.product-type.bundle"
      target.build_configurations.each do |config|
        config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
    # 若仍有其他Pod报错,可尝试添加以下配置(针对非bundle target)
    # target.build_configurations.each do |config|
    #   config.build_settings['CODE_SIGNING_STYLE'] = 'Automatic'
    # end
  end
end

提交修改后,确保流水线中包含pod install步骤并重新执行。

方案2:调整Azure DevOps Xcode任务配置,使用ExportOptions.plist控制签名

  1. 在项目ios目录下创建ExportOptions.plist文件,内容根据你的发布类型调整(示例为Ad Hoc发布):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>method</key>
    <string>ad-hoc</string> <!-- 可选:app-store, enterprise, development -->
    <key>signingStyle</key>
    <string>manual</string>
    <key>provisioningProfiles</key>
    <dict>
        <key>com.yourcompany.newapp</key> <!-- 替换为你的应用Bundle ID -->
        <string>$(APPLE_PROV_PROFILE_NAME)</string> <!-- 或直接写配置文件名称,而非UUID -->
    </dict>
    <key>teamID</key>
    <string>YOUR_TEAM_ID</string> <!-- 替换为你的Apple Team ID -->
</dict>
</plist>
  1. 修改Azure DevOps的Xcode@5任务配置,改用exportOptionsPlist指定签名规则:
- task: Xcode@5
  displayName: "Build IPA"
  inputs:
    actions: "build"
    configuration: "Release"
    sdk: "iphoneos"
    xcWorkspacePath: "ios/newapp.xcworkspace"
    scheme: "NewApp"
    packageApp: true
    exportPath: "output"
    signingOption: "default" # 改为default,由ExportOptions.plist控制签名
    exportOptionsPlist: "ios/ExportOptions.plist" # 指定plist路径
    useXcpretty: false
    args: "-UseModernBuildSystem=YES" # 确保使用现代构建系统
  1. 确认流水线已通过InstallAppleCertificate@2和InstallAppleProvisioningProfile@1任务正确导入证书与配置文件,且APPLE_PROV_PROFILE_NAME变量已设置为对应配置文件名称。

方案3:使用Expo EAS Build替代手动Xcode构建

如果团队允许,可切换到Expo官方的EAS Build服务,它会自动处理SDK 50的签名配置,无需手动维护Azure DevOps的Xcode任务。只需在项目中执行eas build:configure,然后在流水线中调用eas build命令即可完成构建。

验证步骤

  1. 推送修改后的Podfile/ExportOptions.plist到代码仓库
  2. 触发Azure DevOps流水线,观察Xcode构建步骤是否正常完成
  3. 检查output目录下是否生成了正确的IPA文件

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.29 17:54:51