1

I am trying to build .ipa file in codemagic, but it fails with below message

Archive Execute "xcodebuild -project . -scheme Optivio -archivePath build/ios/xcarchive/_ijalmu93.xcarchive archive COMPILER_INDEX_STORE_ENABLE=NO"

Failed to archive .

Build failed :| Step 7 script Build .ipa exited with status code 66

and my code in yaml file for build ipa is,

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

I don't have workspace, only project. when archive in Xcode got success.

Code magic screenshot: https://ibb.co/YjFg0gh

My full yaml file below,

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:
          - [email protected]
        notify:
          success: true
          failure: true
8
  • Do you have any pods? Do you use xcworkspace? Commented May 21, 2021 at 11:58
  • No, I didn't have any pods and I didn't use xcworkspace Commented May 21, 2021 at 12:14
  • Add your yaml above, double check your project and scheme. Commented May 21, 2021 at 12:31
  • I have added the full yaml file code above Commented May 21, 2021 at 12:45
  • Is your scheme correct? Commented May 21, 2021 at 12:59

1 Answer 1

0

I know this is an old question, but we have encountered a similar error today (2025-01-31).

Archive myreactapp.xcworkspace
Execute "xcodebuild -workspace /Users/builder/clone/ios/myreactapp.xcworkspace -scheme myreactapp -destination generic/platform=iOS -archivePath build/ios/xcarchive/myreactapp_xxxxx.xcarchive archive COMPILER_INDEX_STORE_ENABLE=NO DEVELOPMENT_TEAM=E6SUQF7E9W 'CODE_SIGN_IDENTITY=Apple Distribution' CODE_SIGN_STYLE=Manual"


Failed to archive /Users/builder/clone/ios/myreactapp.xcworkspace

It turned out the error was due to the expired provisioning profile. Wasted a few hours today on this silly mistake.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.