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

CodeMagic执行xcode-project use-profiles失败,FastImage签名设置出错

解决CodeMagic构建iOS应用时xcode-project use-profiles报错问题

问题场景

使用CodeMagic构建React Native iOS应用时,配置的构建脚本如下:

scripts:
  - name: Install dependencies
    script: |
        yarn install
  - name: Install CocoaPods dependencies
    script: |
        cd ios && pod install
  - name: Set up provisioning profiles settings on Xcode project
    script: |
      sudo gem install xcodeproj
      sudo xcode-project use-profiles
  - name: Build ipa for distribution
    script: |
      xcode-project build-ipa \
        --workspace "$CM_BUILD_DIR/ios/$XCODE_WORKSPACE" \
        --scheme "$XCODE_SCHEME"

执行sudo xcode-project use-profiles步骤时,出现错误:

Failed to set code signing settings for node_modules/react-native-fast-image/ios/FastImage.xcodeproj

解决方案

1. 移除sudo权限执行命令

CodeMagic构建环境中普通用户权限已足够完成配置操作,使用sudo会改变文件所有权,导致无法正确修改第三方库的项目配置。修改脚本如下:

- name: Set up provisioning profiles settings on Xcode project
  script: |
    gem install xcodeproj
    xcode-project use-profiles

2. 统一配置第三方Pods的签名规则

在ios/Podfile中添加post_install钩子,让所有第三方库自动继承主项目的签名设置,避免单独处理某个库的问题:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # 设置签名方式为自动
      config.build_settings['CODE_SIGN_STYLE'] = 'Automatic'
      # 可选:指定开发团队ID,也可留空让Xcode自动匹配
      # config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_TEAM_ID'
    end
  end
end

修改Podfile后,重新执行pod install即可生效。

3. 限定xcode-project use-profiles的处理范围

如果只需要配置主项目的签名,可指定具体的项目或工作空间,避免处理Pods中的子项目:

xcode-project use-profiles --workspace "$CM_BUILD_DIR/ios/$XCODE_WORKSPACE" --scheme "$XCODE_SCHEME"

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 14:12:53