New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gym correctly detected provisioning profiles but archiving uses project defined profile #10458

Kalvin126 opened this Issue Sep 29, 2017 · 17 comments


None yet
9 participants

Kalvin126 commented Sep 29, 2017

New Issue Checklist

Issue Description

We just updated to Xcode 9 and are now seeing issues with out Crashlytics lanes.
Our Xcode project by default defines Development profile for manual signing to use. For Crashlytics lane, we define the export options to use our Enterprise profile but xcodebuild still is trying to use the Development profile to sign the .ipa. I have verified the bundle ids are correct and have read the Xcode 9 code signing migration guide.

[17:55:58]: -------------------------------------------------
[17:55:58]: --- Step: Verifying required fastlane version ---
[17:55:58]: -------------------------------------------------
[17:55:58]: Your fastlane version 2.59.0 matches the minimum requirement of 2.00.0  ✅
[17:55:58]: ------------------------------
[17:55:58]: --- Step: default_platform ---
[17:55:58]: ------------------------------
[17:55:58]: Driving the lane 'ios nightly' 🚀
[17:55:58]: -----------------------
[17:55:58]: --- Step: preflight ---
[17:55:58]: -----------------------
[17:55:59]: ---------------------------------
[17:55:59]: --- Step: update_project_team ---
[17:55:59]: ---------------------------------
[17:55:59]: Updating development team (<REDACTED>) for the given project './apps/Business/<REDACTED>.xcodeproj/project.pbxproj'
[17:55:59]: Successfully updated project settings to use Developer Team ID '<REDACTED>'
[17:55:59]: -----------------
[17:55:59]: --- Step: gym ---
[17:55:59]: -----------------
[17:55:59]: Detected provisioning profile mapping: {:"<REDACTED>.debug"=>"<Enterprise profile> ", :"<REDACTED>"=>"<Enterprise profile> "}
[17:55:59]: $ xcodebuild -list -workspace <REDACTED>\ Business.xcworkspace -configuration Debug
[17:56:02]: $ xcodebuild -showBuildSettings -workspace <REDACTED>\ Business.xcworkspace -scheme <REDACTED>\ Business -configuration Debug

|                                      Summary for gym 2.59.0                                       |
| workspace                                       | <REDACTED>.xcworkspace                     |
| scheme                                          | <REDACTED>                                 |
| configuration                                   | Debug                                           |
| silent                                          | true                                            |
| export_options.method                           | enterprise                                      |
|<REDACTED>  | <Enterprise profile>                                 |
| .debug                                 |                                                 |
|<REDACTED>  | <Enterprise profile>                                 |
|                                        |                                                 |
| export_options.signingCertificate               | iPhone Distribution: <REDACTED>                |
| destination                                     | generic/platform=iOS                            |
| output_name                                     | <REDACTED>                                 |
| build_path                                      | /Users/vader/Library/Developer/Xcode/Archives/  |
|                                                 | 2017-09-28                                      |
| clean                                           | false                                           |
| output_directory                                | .                                               |
| skip_package_ipa                                | false                                           |
| buildlog_path                                   | ~/Library/Logs/gym                              |
| xcode_path                                      | /Applications/                         |



The following build commands failed:
Check dependencies
(1 failure)
[17:58:35]: Exit status: 65
[17:58:35]: Maybe the error shown is caused by using the wrong version of Xcode
[17:58:35]: Found multiple versions of Xcode in '/Applications/'
[17:58:35]: Make sure you selected the right version for your project
[17:58:35]: This build process was executed using '/Applications/'
[17:58:35]: If you want to update your Xcode path, either
[17:58:35]: - Specify the Xcode version in your Fastfile
[17:58:35]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[17:58:35]: - Specify an absolute path to your Xcode installation in your Fastfile
[17:58:35]: ▸ xcode_select "/Applications/"
[17:58:35]: - Manually update the path using
[17:58:35]: ▸ sudo xcode-select -s /Applications/

|           Build environment           |
| xcode_path  | /Applications/ |
| gym_version | 2.59.0                  |
| sdk         | iPhoneOS11.0.sdk        |

[17:58:35]: ▸ Check dependencies
[17:58:35]: ▸ Code Signing Error: Provisioning profile "Development" doesn't include signing certificate "iPhone Developer: Kalvin Loc (2DFD28K7P9)".
[17:58:35]: ▸ Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.0'
[17:58:35]: ⬆️  Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[17:58:35]: 📋  For the complete and more detailed error log, check the full log at:
[17:58:35]: 📋  /Users/vader/Library/Logs/gym/<REDACTED>-<REDACTED>.log
[17:58:35]: Looks like fastlane ran into a build/archive error with your project
[17:58:35]: It's hard to tell what's causing the error, so we wrote some guides on how
[17:58:35]: to troubleshoot build and signing issues:
[17:58:35]: Before submitting an issue on GitHub, please follow the guide above and make
[17:58:35]: sure your project is set up correctly.
[17:58:35]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[17:58:35]: the full commands printed out in yellow in the above log.
[17:58:35]: Make sure to inspect the output above, as usually you'll find more error information there
|          Lane Context          |
| DEFAULT_PLATFORM | ios         |
| PLATFORM_NAME    | ios         |
| LANE_NAME        | ios nightly |
[17:58:35]: Error building the application - see the log above

|                 fastlane summary                  |
| Step | Action                       | Time (in s) |
| 1    | Verifying required fastlane  | 0           |
|      | version                      |             |
| 2    | default_platform             | 0           |
| 3    | preflight                    | 0           |
| 4    | update_project_team          | 0           |
| 💥   | gym                          | 156         |

[17:58:35]: fastlane finished with errors

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


fastlane environment


Key Value
OS 10.12.6
Ruby 2.4.1
Bundler? true
Git git version 2.12.2
Installation Source ~/Desktop//vendor/bundle/ruby/2.4.0/bin/fastlane
Host Mac OS X 10.12.6 (16G29)
Ruby Lib Dir ~/.rvm/rubies/ruby-2.4.1/lib
OpenSSL Version OpenSSL 1.1.0f 25 May 2017
Is contained false
Is homebrew false
Is installed via false
Xcode Path /Applications/
Xcode Version 9.0

System Locale

Variable Value

fastlane files:

fastlane_version "2.00.0"

default_platform :ios

platform :ios do
  before_all do

## bootstraping

desc "Run project bootstrap"
desc "You need to do this on clean checkout and it needs to pass for a sucessfull build"
lane :bootstrap do |options|
  bundle_install deployment: true
  javascript(npm: !options[:skipNpm], skipCheck:options[:skipCheck], release:options[:release])
  notification(subtitle: "<REDACTED>", message: "Bootstrap finished")

desc "Run Manticore setup"
desc "Install required Javascript environment, create final js file, generate native shims"
lane :manticore do |options|
  javascript(npm: !options[:skipNpm])

desc "Run cocoapods setup"
desc "Install cocoapods for project"
lane :pods do
   cocoapods repo_update: true

## testing

desc "Full app test"
desc "Clean derived data, clean project, run all the tests, unit and integration"
lane :test do
    scheme: '<REDACTED>',
    code_coverage: true

## delivery

desc "Crashlytics"
desc "Publish new version of the app to crashlytics"
desc "skipBuild:true will skip building and do only push"
desc "configuration: sets build configuration, defaults to Debug"
lane :nightly do |options|
 unless options[:skipBuild]
   xcodeprojpath = './apps/Business/<REDACTED>.xcodeproj'

     increment_build_number(build_number: ENV['BUILD_NUMBER'], xcodeproj: xcodeprojpath)
   group = 'nightly'
   config = 'Debug'
   if options[:configuration]
    config = options[:configuration]

  update_project_team(path: xcodeprojpath, teamid: ENV['FASTLANE_TEAM_ID'])

    workspace: '<REDACTED>.xcworkspace',
    scheme: '<REDACTED>',
    configuration: config,
    silent: true,
    export_options: {
      method: "enterprise",
      provisioningProfiles: {
        "<REDACTED>.debug": "<REDACTED>",
        "<REDACTED>": "<REDACTED>"
      signingCertificate: "iPhone Distribution: <REDACTED>"

crashlytics api_token: CRASHLYTICS_API_KEY, build_secret: CRASHLYTICS_API_SECRET, groups: group

desc "Testflight"
desc "Build and submit a new Beta Build to Apple TestFlight"
desc "skipBuild:true will skip building and do only push"
lane :beta do |options|
  unless options[:skipBuild]
    bootstrap release: true

    xcodeprojpath = './apps/Business/<REDACTED>.xcodeproj'
    increment_build_number(xcodeproj: './apps/Business/<REDACTED>.xcodeproj')
    disable_automatic_code_signing(path: xcodeprojpath, team_id: ENV['FASTLANE_TEAM_ID'], targets: ["<REDACTED>"])
    update_project_team(path: xcodeprojpath, teamid: ENV['FASTLANE_TEAM_ID'])

    build_settings_to_override = {

      scheme: '<REDACTED>',
      export_method: 'app-store',
      configuration: 'Release',
      codesigning_identity: 'iPhone Distribution: <REDACTED>',
      xcargs: build_settings_to_override

    skip_waiting_for_build_processing: true,
    skip_submission: true

app_identifier "<REDACTED>" # The bundle identifier of your app
apple_id "cfyffe@<REDACTED>.com" # Your Apple email address

for_platform :ios do
  for_lane :nightly do
	team_id "<REDACTED>"

  for_lane :beta do
	team_id "<REDACTED"

  # Developer Portal Team ID

# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information:

fastlane gems

Gem Version Update-Status
fastlane 2.59.0 Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.1.0
executable-hooks 1.3.2
bundler-unload 1.0.2
rubygems-bundler 1.4.4
bundler 1.15.4
io-console 0.4.6
CFPropertyList 2.3.5
i18n 0.8.6
minitest 5.10.3
thread_safe 0.3.6
tzinfo 1.2.3
activesupport 4.2.10
public_suffix 2.0.5
addressable 2.5.2
babosa 1.0.2
claide 1.0.2
fuzzy_match 2.0.4
nap 1.1.0
cocoapods-core 1.3.1
cocoapods-deintegrate 1.0.1
cocoapods-downloader 1.1.3
cocoapods-plugins 1.0.0
cocoapods-search 1.0.0
cocoapods-stats 1.0.0
netrc 0.7.8
cocoapods-trunk 1.2.0
cocoapods-try 1.1.0
colored2 3.1.2
escape 0.0.4
fourflusher 2.0.1
gh_inspector 1.0.3
molinillo 0.5.7
ruby-macho 1.1.0
nanaimo 0.2.3
xcodeproj 1.5.2
cocoapods 1.3.1
colored 1.2
highline 1.7.8
commander-fastlane 4.4.5
declarative 0.0.10
declarative-option 0.1.0
unf 0.1.4
domain_name 0.5.20170404
dotenv 2.2.1
excon 0.59.0
multipart-post 2.0.0
faraday 0.13.1
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
faraday_middleware 0.12.2
fastimage 2.1.0
jwt 1.5.6
little-plugger 1.1.4
multi_json 1.12.2
logging 2.2.2
memoist 0.16.0
os 0.9.6
signet 0.7.3
googleauth 0.5.3
httpclient 2.8.3
mime-types-data 3.2016.0521
mime-types 3.1
uber 0.1.0
representable 3.0.4
retriable 3.1.1
google-api-client 0.13.6
json 2.1.0
mini_magick 4.5.1
multi_xml 0.6.0
plist 3.3.0
rubyzip 1.2.1
security 0.1.3
slack-notifier 1.5.1
terminal-notifier 1.8.0
unicode-display_width 1.3.0
terminal-table 1.8.0
tty-screen 0.5.0
word_wrap 1.0.0
rouge 2.0.7
xcpretty 0.2.8
xcpretty-travis-formatter 0.0.4

generated on: 2017-09-28


This comment has been minimized.

fastlane-bot commented Sep 29, 2017

It seems like this issue might be related to code signing 🚫

Have you seen our new Code Signing Troubleshooting Guide? It will help you resolve the most common code signing issues 👍


This comment has been minimized.

arriaowlia commented Sep 29, 2017

it looks like the xcodebuild command does not reference exportOptionsPlist. i am seeing the same thing, using match.


This comment has been minimized.


dtrenz commented Sep 29, 2017

I am seeing the same issue when using export_method "app-store". I'm setting GYM_CONFIGURATION to "App Store" but gym selects "Development" profiles.
I believe that this is a regression. This was working (nightly) until updating to Xcode 9 (fastlane 2.59.0)

UPDATE: Developer error 🤦‍♂️ – I'm no longer experiencing this issue.


This comment has been minimized.

365SplendidSuns commented Sep 30, 2017

I'm having a similar problem. The profile was made using match using type "appstore" and the profile name is match AppStore The export method is app-store but for some reason the profile type is showing as development and so gym fails.

There seems to be a mismatch between your provided export_method in gym
[17:21:58]: and the selected provisioning profiles. You passed the following options:
[17:21:58]: export_method: app-store
[17:21:58]: Bundle identifier:
[17:21:58]: Profile name: match AppStore
[17:21:58]: Profile type: development
[17:21:58]: Make sure to either change the export_method passed from your Fastfile or CLI
[17:21:58]: or select the correct provisioning profiles by updating your Xcode project
[17:21:58]: or passing the profiles to use by using match or manually via the export_options hash

@Kalvin126 Kalvin126 changed the title from gym correctly detected provisioning profiles archiving uses project defined profile to gym correctly detected provisioning profiles but archiving uses project defined profile Sep 30, 2017


This comment has been minimized.

Kalvin126 commented Sep 30, 2017

@KrauseFx am I properly setting the Provisioning profile per bundle identifier? Or is there a different way? We used to set it by overrideing PROVISIONING_PROFILE_SPECIFIER but that also overrides for CocoaPods as well, then xcodebuild says the pods does not allow code signing.


This comment has been minimized.

grantjbutler commented Oct 3, 2017

We ran into a similar issue and found that it was because our provisioning profile name contained underscores. We found that gym doesn't take underscores into account when generating the provisioning profile mapping†. If your profile also contains underscores, I'd suggest removing them and seeing if archiving works.

† If your export method is :app-store, gym will try to find a provisioning profile for the App Store by seeing if the profile name contains the string appstore. For our profile, this meant that gym was checking if the string <product>_app_store contained the string appstore. It didn't, so gym defaulted to what was detected in the project.


This comment has been minimized.

Kalvin126 commented Oct 3, 2017

The default profile set in the xcodeproj has a space, but the enterprise profile does not have any spaces or underscores at all.


This comment has been minimized.

Kalvin126 commented Oct 5, 2017

with fastlane 2.60.1, it now correctly uses the provided provisioning profiles in export options, but it ignores the signing identity :(


This comment has been minimized.

Kalvin126 commented Oct 5, 2017

omitting signingIdentity works! closing

@Kalvin126 Kalvin126 closed this Oct 5, 2017

@Kalvin126 Kalvin126 reopened this Oct 5, 2017


This comment has been minimized.

Kalvin126 commented Oct 5, 2017

I take that back, I had actually changed the default profile which resulted in it working. Ideally I want development profiles to be set by default. Then in Fastfile, I want it to override the profile. But doing so, it seems to not care about provisioning profile override and uses the development profile and certificate.


This comment has been minimized.

ankur-sardar commented Oct 6, 2017

Did you found any solution for this?


This comment has been minimized.

Kalvin126 commented Oct 6, 2017

Still no solution. This happens even with 2.60.1


This comment has been minimized.

Kalvin126 commented Oct 6, 2017

Maybe #10508 would fix this


This comment has been minimized.

Kalvin126 commented Oct 6, 2017

I did not initially add signingStyle: "manual" to the export options, but even then it still ignores the provisioning profile and signingCert defined in my options.


This comment has been minimized.

ammoqq commented Oct 28, 2017

same issue with xcode9 for adhoc it seems to not care about what provisioning i put into gym. Just takes the xcodeproj settings


This comment has been minimized.


ohayon commented Oct 31, 2017

Hey @ammoqq - any chance you could share the output of your command line when your run your fastlane command with --verbose? Thanks!


This comment has been minimized.

Kalvin126 commented Nov 1, 2017

So after some debugging and reading logs, I got it to actually generate a plist and use the correct profile and signing certificate. Our dev machines has the dev provisioning profiles but the CI does not and it was outputting an error even though I wanted to override the profile. Adding the dev profile allowed me to continue and actually used the passed signing options.

I now get an error that xcodebuild is trying to use the profile and signing cert to sign all my Pod targets which I don't want to happen. This seems like a draw back that cannot be avoided? Anyways, my team will instead go the route of setting profile and signing cert per Xcode configuration. Closing this issue for now.

@Kalvin126 Kalvin126 closed this Nov 1, 2017

@fastlane fastlane locked and limited conversation to collaborators Dec 31, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.