Ios - xcodebuild archive fails with exit status 65

Outline

Hello!
I am attempting to automate adhoc build by using fastlane with match and gym.
I can archive at local environment.
But I couldn’t archive at Circle CI.
Looks like xcodebuild command was failed.
I login job by ssh, and this command is failed at Circle CI .

$ xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Release -destination ‘generic/platform=iOS’ -archivePath MyApp.xcarchive clean archive | tee /Users/distiller/Library/Logs/gym/MyApp-MyApp.log

Please tell me solution.

What I did

https://circleci.com/docs/2.0/ios-codesigning/
I have set up project setting by referring this page.

My code sign settig is here.

fastlane is here.

version: 2
jobs:
 setup:
   macos:
     xcode: "9.2.0"
   shell: /bin/bash --login -eo pipefail
   steps:
     - checkout
     - run:
         name: Set Ruby Version
         command:  echo "ruby-2.4" > ~/.ruby-version
     - restore_cache:
         keys:
           - gems-{{ checksum "Gemfile.lock" }}
     - run:
         name: Running bundle install
         command: bundle check || bundle install --path vendor/bundle
         environment:
             - BUNDLE_JOBS: 4
             - BUNDLE_RETRY: 3
     - save_cache:
         key: gems-{{ checksum "Gemfile.lock" }}
         paths:
           - vendor/bundle
     - restore_cache:
         keys:
           - pods--{{ checksum "Podfile.lock" }}
     - run:
         name: Running pod install
         command: |
           curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
           bundle exec pod install
     - save_cache:
         key: pods-{{ checksum "Podfile.lock" }}
         paths:
           - Pods
           - MyApp.xcworkspace
 beta-deployment:
   macos:
     xcode: "9.2.0"
   shell: /bin/bash --login -eo pipefail
   steps:
     - checkout
     - restore_cache:
         keys:
           - gems-{{ checksum "Gemfile.lock" }}
     - restore_cache:
         keys:
           - pods-{{ checksum "Podfile.lock" }}
     - run: echo "ruby-2.4" > ~/.ruby-version
     - run: bundle install
     - run: bundle exec fastlane build_adhoc
     - store_artifacts:
         path: MyApp.app.dSYM.zip
     - store_artifacts:
         path: MyApp.ipa
workflows:
  version: 2
  build_test_deployment:
    jobs:
      - setup
      - beta-deployment:
          requires:
            - setup

config.yml is here.

fastlane_version "2.35.1"

default_platform :ios

platform :ios do
  lane :build_adhoc do
    setup_circle_ci
    match(type: "appstore", app_identifier: "jp.hogehoge.MyApp", readonly: true)
    match(type: "adhoc", app_identifier: "jp.hogehoge.MyApp", readonly: true)
    gym(
      scheme: "MyApp",
      workspace: "MyApp.xcworkspace",
      configuration: "Release",
      export_method: "ad-hoc",
      export_options: {
        provisioningProfiles: {
        "jp.hogehoge.MyApp" => "match AdHoc jp.hogehoge.MyApp"
        }
      },
      clean: true
    )
  end
end

failed log is here.



▸ Running script ‘[CP] Embed Pods Frameworks’
▸ Running script ‘[CP] Copy Pods Resources’
▸ Touching MyApp.app
▸ Signing /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dsgauupkymppmmgymocmzptqnqrr/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
▸ Touching MyApp.app.dSYM
** ARCHIVE FAILED **
[01:51:08]: Exit status: 65
[01:51:08]:
[01:51:08]: Maybe the error shown is caused by using the wrong version of Xcode
[01:51:08]: Found multiple versions of Xcode in ‘/Applications/’
[01:51:08]: Make sure you selected the right version for your project
[01:51:08]: This build process was executed using ‘/Applications/Xcode-9.2.app’
[01:51:08]: If you want to update your Xcode path, either
[01:51:08]:
[01:51:08]: - Specify the Xcode version in your Fastfile
[01:51:08]: ▸ xcversion(version: “8.1”) # Selects Xcode 8.1.0
[01:51:08]:
[01:51:08]: - Specify an absolute path to your Xcode installation in your Fastfile
[01:51:08]: ▸ xcode_select “/Applications/Xcode8.app”
[01:51:08]:
[01:51:08]: - Manually update the path using
[01:51:08]: ▸ sudo xcode-select -s /Applications/Xcode.app
[01:51:08]:

±--------------±----------------------------+
| Build environment |
±--------------±----------------------------+
| xcode_path | /Applications/Xcode-9.2.app |
| gym_version | 2.79.0 |
| export_method | ad-hoc |
| sdk | iPhoneOS11.2.sdk |
±--------------±----------------------------+

[01:51:08]: ▸ Touch /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dsgauupkymppmmgymocmzptqnqrr/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphoneos/MyApp.app.dSYM
[01:51:08]: ▸ cd /Users/distiller/project
[01:51:08]: ▸ export PATH=“/Applications/Xcode-9.2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode-9.2.app/Contents/Developer/usr/bin:/Users/distiller/.gem/ruby/2.4.2/bin:/Users/distiller/.rubies/ruby-2.4.2/lib/ruby/gems/2.4.0/bin:/Users/distiller/.rubies/ruby-2.4.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin”
[01:51:08]: ▸ /usr/bin/touch -c /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dsgauupkymppmmgymocmzptqnqrr/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphoneos/MyApp.app.dSYM
[01:51:08]:
[01:51:08]: :arrow_up: Check out the few lines of raw xcodebuild output above for potential hints on how to solve this error
[01:51:08]: :clipboard: For the complete and more detailed error log, check the full log at:
[01:51:08]: :clipboard: /Users/distiller/Library/Logs/gym/MyApp-MyApp.log
[01:51:08]:
[01:51:08]: Looks like fastlane ran into a build/archive error with your project
[01:51:08]: It’s hard to tell what’s causing the error, so we wrote some guides on how
[01:51:08]: to troubleshoot build and signing issues: docs.fastlane.tools/codesigning/getting-started/
[01:51:08]: Before submitting an issue on GitHub, please follow the guide above and make
[01:51:08]: sure your project is set up correctly.
[01:51:08]: fastlane uses xcodebuild commands to generate your binary, you can see the
[01:51:08]: the full commands printed out in yellow in the above log.
[01:51:08]: Make sure to inspect the output above, as usually you’ll find more error information there
[01:51:08]:
±-----------------------------------±-------------------------------------------------------------------------------+
| Lane Context |
±-----------------------------------±-------------------------------------------------------------------------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios build_adhoc |
| ORIGINAL_DEFAULT_KEYCHAIN | “/Users/distiller/Library/Keychains/login.keychain-db” |
| SIGH_PROFILE_TYPE | ad-hoc |
| MATCH_PROVISIONING_PROFILE_MAPPING | {“jp.hogehoge.MyApp”=>“match AdHoc jp.hogehoge.MyApp”} |
±-----------------------------------±-------------------------------------------------------------------------------+
[01:51:08]: Error building the application - see the log above

±-----±--------------------------------±------------+
| fastlane summary |
±-----±--------------------------------±------------+
| Step | Action | Time (in s) |
±-----±--------------------------------±------------+
| 1 | Verifying fastlane version | 0 |
| 2 | default_platform | 0 |
| 3 | setup_circle_ci | 0 |
| 4 | Switch to ios certificates lane | 0 |
| 5 | match | 2 |
| 6 | match | 2 |
| 7 | match | 1 |
| :boom: | gym | 207 |
±-----±--------------------------------±------------+

[01:51:08]: fastlane finished with errors

[!] Error building the application - see the log above

[23:25:14]: WARNING: fastlane requires your locale to be set to UTF-8. To learn more go ://docs.fastlane.tools/getting-started/ios/setup/#set-up-environment-variables
Exited with code 1

Did you managed to resolve the issue?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.