How to automatize the provisioning profile generation with fastlane for your development team for running macos apps?

193 Views Asked by At

I need to set up my team's computers for running a macos app made with Flutter, for that purpose I read I need certificates and profiles and that fastlane match is an ideal tool for handling this pain. The thing is that this error shows up even after running the command properly:

error: Provisioning profile "match Development your.company.reverse.domain macos" doesn't include signing certificate "Apple Development: Your Company Team (ABC1N23WN4)". (in target 'Runner' from project 'Runner')

My tech lead said that this happens because my computer isn't (or wasn't) registered in our Apple account when the certificates were generated, so for automatizing the registering of every team member (and certificate rebuilding aftwerwards) I need to write a script for both registering my teammate's Mac and rebuilding the provisioning profiles. How can I do that?

1

There are 1 best solutions below

0
Nico Rodsevich On

Create a fastfile with the following:

default_platform(:ios)

platform :ios do
  desc "Set up your computer for running the macos app"
  lane :install do
    name = "#{`whoami`.chop}'s Mac (#{`hostname`.chop})"
    uuid = `ioreg -d2 -c IOPlatformExpertDevice | awk -F\\" '/IOPlatformUUID/{print $(NF-1)}'`
    register_device(
      name: name,
      udid: uuid.chop,
      platform: "mac"
    )
    match
  end
end

That way you will be able to add a new device to you apple account by just running fastlane install in your macos dir.

Note: make sure you have a good configured Matchfile like the following one for having match working properly (or define in the lane the parameters otherwise):

storage_mode("git")

platform("macos")

# recreate the certificates if a new device was effectively added
force_for_new_devices(true)
# recreates everytime. Not a sin to use it but with force_for_new_devices it's not needed
# force(true)

# solves a lot of issues and is cheap
include_all_certificates(true)

# it will only work with development in certain circumstances
type("development")