首页 > 解决方案 > 在 Codemagic iOS 本机中构建 .ipa 失败

问题描述

我正在尝试在 codemagic 中构建 .ipa 文件,但失败并显示以下消息

归档执行“xcodebuild -project .-scheme Optivio -archivePath build/ios/xcarchive/_ijalmu93.xcarchive archive COMPILER_INDEX_STORE_ENABLE=NO”

存档失败。

构建失败:| 第 7 步脚本Build .ipa以状态码 66 退出

我在构建 ipa 的 yaml 文件中的代码是,

xcode-project build-ipa --project "$XCODE_PROJECT" --scheme "$XCODE_SCHEME"

我没有工作区,只有项目。当 Xcode 中的存档成功时。

代码魔术截图:https ://ibb.co/YjFg0gh

下面是我的完整 yaml 文件,

workflows:
ios-testApp:
  name: ios_testApp
  environment:
    vars:
      XCODE_PROJECT:: “TestApp.xcodeproj" # <-- Put the name of your workspace here.
      XCODE_SCHEME: "TestApp" # <-- Put the name of your scheme here.
      # Set up env vars for manual codesigning (See - https://docs.codemagic.io/code-signing-yaml/signing-ios/)
      CM_CERTIFICATE: Encrypted(…….) # <-- Put your encrypted distribution certificate here.
      CM_CERTIFICATE_PASSWORD: Encrypted(…….) # <-- Put your encrypted distribution certificate password here.
      CM_PROVISIONING_PROFILE: Encrypted(…….) # <-- Put your encrypted provisioning profile here.
    xcode: 12.4
    cocoapods: default
  triggering:
    events:
      - push
      - tag
      - pull_request
    branch_patterns:
      - pattern: 'master'
        include: true
        source: true
  scripts:
    - name: Initialize keychain to be used for codesigning using Codemagic CLI 'keychain' command
      script: |
        keychain initialize
    - name: set up provisioning profiles
      script: |
        PROFILES_HOME="/Users/vadivel/Library/MobileDevice/Provisioning Profiles"
        mkdir -p "$PROFILES_HOME"
        PROFILE_PATH="$(mktemp "$PROFILES_HOME"/$(uuidgen).mobileprovision)"
        echo ${CM_PROVISIONING_PROFILE} | base64 --decode > $PROFILE_PATH
        echo "Saved provisioning profile $PROFILE_PATH"
    - name: Add signing certificate to keychain
      script: |
        echo $CM_CERTIFICATE | base64 --decode > /tmp/certificate.p12
        keychain add-certificates --certificate /tmp/certificate.p12 --certificate-password $CM_CERTIFICATE_PASSWORD
    - name: Set up code signing settings on Xcode project
      script: |
        xcode-project use-profiles
    - name: Build .ipa
      script: |
        xcode-project build-ipa --project "$XCODE_PROJECT" --scheme "$XCODE_SCHEME"
  artifacts:
    - build/ios/ipa/*.ipa
    - /Users/vadivel/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM
  publishing:
    email:
        recipients:
          - xxxxx@gmail.com
        notify:
          success: true
          failure: true

标签: iosxcodecodemagic

解决方案


推荐阅读