fastlane: gym is failing when code signing (Sierra & Xcode 7 & gym 1.11.0)

New Issue Checklist

Issue Description

Since when I updated to Sierra, fastlane is failing during code signing.

I tried to search for similar issues, but couldn’t find any.

If you are wondering why I’m using a Develop certificate, the reason is that I need to provide an app where I can use the Safari Web Inspector, and as soon as you use a distribution one you can’t use the inspector.

Complete output when running fastlane, including the stack trace and command used
[17:49:29]: ▸ Archive Succeeded
[17:49:30]: Legacy build api is enabled, the `export_method` value will be ignored
[17:49:30]: $ /usr/bin/xcrun /tmp/PackageApplication4Gym -v /Users/administrator/Library/Developer/Xcode/Archives/2016-10-07/MyApp\ 2016-10-07\ 17.42.49.xcarchive/Products/Applications/MyApp.app -o '/var/folders/1f/z5p2sv815757zxp5b7pjn3h40000gn/T/gym_output20161007-74777-1uqmilw/MyApp.ipa' exportFormat ipa --sign iPhone\ Developer:\ Luca\ Torella\ \(GL45QA258Y\) 
Packaging application: '/Users/administrator/Library/Developer/Xcode/Archives/2016-10-07/MyApp 2016-10-07 17.42.49.xcarchive/Products/Applications/MyApp.app'
Arguments: output=/var/folders/1f/z5p2sv815757zxp5b7pjn3h40000gn/T/gym_output20161007-74777-1uqmilw/MyApp.ipa  sign=iPhone Developer: Luca Torella (GL45QA258Y)  verbose=1
Environment variables:
BUNDLE_ORIG_PATH = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/administrator/tools/android-sdk/platform-tools/
SSH_CONNECTION = 213.200.225.210 63714 208.52.182.87 22
SHLVL = 2
FASTLANE_LANE_NAME = develop
SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
PWD = /Users/administrator/workspace/iOS/iOS-Calabash-Build/platforms/ios
BUNDLE_BIN_PATH = /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle
USER = administrator
RUBYLIB = /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib
GEM_HOME = /usr/local/lib/ruby/gems/2.3.0
LOGNAME = administrator
RUBYOPT = -rbundler/setup
VERSIONER_PERL_PREFER_32_BIT = no
__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0
PATH = /usr/local/lib/ruby/gems/2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/administrator/tools/android-sdk/platform-tools/
LC_CTYPE = UTF-8
SSH_TTY = /dev/ttys001
FASTLANE_PLATFORM_NAME = ios
SSH_CLIENT = 213.200.225.210 63714 22
LSCOLORS = ExFxBxDxCxegedabagacad
_ = /usr/bin/xcrun
TERM = xterm-256color
TMPDIR = /var/folders/1f/z5p2sv815757zxp5b7pjn3h40000gn/T/
VERSIONER_PERL_VERSION = 5.18
LC_ALL = en_US.UTF-8
MAIL = /var/mail/administrator
SHELL = /bin/bash
BUNDLE_GEMFILE = /Users/administrator/workspace/iOS/iOS-Calabash-Build/platforms/ios/Gemfile
GEM_PATH = /usr/local/lib/ruby/gems/2.3.0:/Users/administrator/.gem/ruby/2.3.0:/usr/local/Cellar/ruby/2.3.0/lib/ruby/gems/2.3.0
HOME = /Users/administrator

Output directory: '/var/folders/1f/z5p2sv815757zxp5b7pjn3h40000gn/T/gym_output20161007-74777-1uqmilw/MyApp.ipa'
Temporary Directory: '/var/folders/1f/z5p2sv815757zxp5b7pjn3h40000gn/T/jV4N8WQyKg'  (will NOT be deleted on exit when verbose set)
+ /bin/cp -Rp /Users/administrator/Library/Developer/Xcode/Archives/2016-10-07/MyApp 2016-10-07 17.42.49.xcarchive/Products/Applications/MyApp.app /var/folders/1f/z5p2sv815757zxp5b7pjn3h40000gn/T/jV4N8WQyKg/Payload
Program /bin/cp returned 0 : []
### Checking original app
+ /usr/bin/codesign --verify --no-strict -vvvv /Users/administrator/Library/Developer/Xcode/Archives/2016-10-07/MyApp 2016-10-07 17.42.49.xcarchive/Products/Applications/MyApp.app
Program /usr/bin/codesign returned 0 : [/Users/administrator/Library/Developer/Xcode/Archives/2016-10-07/MyApp 2016-10-07 17.42.49.xcarchive/Products/Applications/MyApp.app: valid on disk
/Users/administrator/Library/Developer/Xcode/Archives/2016-10-07/MyApp 2016-10-07 17.42.49.xcarchive/Products/Applications/MyApp.app: satisfies its Designated Requirement
]
Done checking the original app
### Codesigning '' with 'iPhone Developer: Luca Torella (GL45QA258Y)'
+ /usr/bin/codesign --force --preserve-metadata=identifier,entitlements --sign iPhone Developer: Luca Torella (GL45QA258Y) /var/folders/1f/z5p2sv815757zxp5b7pjn3h40000gn/T/jV4N8WQyKg/Payload/MyApp.app
Program /usr/bin/codesign returned 0 : []
error: /usr/bin/codesign --force --preserve-metadata=identifier,entitlements --sign iPhone Developer: Luca Torella (GL45QA258Y) /var/folders/1f/z5p2sv815757zxp5b7pjn3h40000gn/T/jV4N8WQyKg/Payload/MyApp.app failed with error 0. Output:
[17:49:37]: Exit status: 1
[17:49:37]: Variable Dump:
[17:49:37]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios develop"}
[17:49:37]: Error packaging up the application

Configuration Files

Fastfile:

  desc "Create a new develop app"
  lane :develop do
    version = get_version_number
    increment_build_number(build_number: version)
    increment_version_number(version_number: ENV['BUILD_NUMBER'])
    badge_text = version + "-" + ENV['BUILD_NUMBER'] + "-orange"
    badge(
      alpha: true,
      dark: true,
      shield_no_resize: false,
      shield: badge_text,
    )
    copy_provisioning_profile(mobileprovision: "Jenkins/MyApp.mobileprovision")
    unlock_keychain(
      path: "/Users/administrator/Library/Keychains/cloudbuild.keychain",
      password: "enHTAj3B7P"
    )
    gym(
      scheme: "MyApp",
      workspace: "MyApp.xcworkspace",
      export_method: "development",
      output_directory: "build/",
      codesigning_identity: 'iPhone Developer: Luca Torella (GL45QA258Y)',
      configuration: 'Staging',
      use_legacy_build_api: true,
      xcargs: "-arch='armv7' \
        APP_PROFILE='7d452853-cf01-42ed-aada-6ee538c737e6' \
        APP_BUNDLE_IDENTIFIER='com.MyComp.MyApp-dev' \
        DISPLAY_NAME='MyApp' \
        CONFIG_PLIST='Staging-Config' \
        DEVELOPER_MODE='YES'",
    )
  end

Environment

fastlane version (run fastlane -v): fastlane 1.105.0

Do you use bundler to execute fastlane (i.e. bundle exec fastlane)? yes (but I got same result if I don’t)

Do you use a Ruby environment manager (e.g. chruby, rbenv, rvm)? no

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

yes, it can be closed. Thanks 👍

Hey everyone, we just pushed a new gym release with gym 1.11.1, that should fix an error in xcodebuild. Xcode depends on system Ruby being used, and sometimes can’t find the system gems. The new release should fix that error. Please disable the use_legacy_build_api flag, update to the latest version of gym and give it a try.

Let us know if that fixes the issue for you. If it doesn’t work still, please share the complete output with the latest version of gym so we can further investigate the problem 👍

Thanks everybody for helping resolve this issue 🚀