7

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("git@github.com: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 "my@apple.id"

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 my@apple.id -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?

Mikkel Selsøe
  • 1,171
  • 1
  • 11
  • 23

1 Answers1

3

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
Francesco Puglisi
  • 2,140
  • 2
  • 18
  • 26
  • The error message appears when running fastlane match from the command line to initialize match and the certificate repository. When running match from a lane, it fetches the certificates. I'm not quite there yet. Clarifying question now. – Mikkel Selsøe Mar 08 '19 at 08:00
  • @MikkelSelsøe Have you tried initialising Match using one team's details and then using my suggested solution? – Francesco Puglisi Mar 08 '19 at 08:57
  • I ended up solving it using one branch per team in the certificates repo as mentioned here: https://docs.fastlane.tools/actions/match/#multiple-teams – Mikkel Selsøe Mar 12 '19 at 12:13