Mikkel Selsøe
Mikkel Selsøe

Reputation: 1201

Fastlane Match with multiple bundle ids with multiple teams

I have an Xcode Project that has multiple targets. Two of the targets produce apps, each with its own bundle id, to be distributed via an Enterprise developer team ID and one target that is distributed via an App Store developer team ID. I am trying to set up Fastlane Match for this project, but I can't make it deal with the multiple teams.

Here's the contents of my Matchfile:

git_url("[email protected]:myorg/certificates-repo.git")
git_branch("master")

app_identifier([
    "my.app.prod",   # <-- Team ID A
    "my.app.dev",    # <-- Team ID B
    "my.app.staging" # <-- Team ID B
])

clone_branch_directly(true)

And my Appfile:

team_id "Team ID B"
apple_id "[email protected]"

When running fastlane match from the command line to initialize Fastlane Match, I get this error:

==========================================
Could not find App ID with bundle identifier 'my.app.prod'
You can easily generate a new App ID on the Developer Portal using 'produce':

fastlane produce -u [email protected] -a my.app.prod --skip_itc

You will be asked for any missing information, like the full name of your app
If the app should also be created on App Store Connect, remove the --skip_itc from the command above
==========================================

An app with that bundle ID needs to exist in order to create a provisioning profile for it

Which makes sense since it doesn't know about Team ID A. Can I bend Fastlane Match to play nice with both my team id's across the various app identifiers?

Upvotes: 9

Views: 10915

Answers (1)

Francesco Puglisi
Francesco Puglisi

Reputation: 2177

You can use environment variables.

  • Create two files named .env.target1 and .env.target2.
  • Define MATCH_APP_IDENTIFIER, FASTLANE_TEAM_ID and MATCH_USERNAME in both files using the appropriate values. You can use .env and .env.default files for shared values to avoid duplication or leave them in your Matchfile/Appfile.
  • Define a lane in your Fastfile that uses match. †
  • Execute match using the following command: fastlane <lane-name> --env target1

lane :<lane-name> do
    match()
end

Upvotes: 3

Related Questions