iOS 签名的 match 管理步骤

match 现在是自动工具 fastlane 的一个组件,用于管理代码签名。

用 match 管理 iOS 的签名无痛感。

下面列举安装和使用步骤:(一般使用者直接跳步骤7)

1、安装 fastlane [注1]

1
2
xcode-select --install
sudo gem install fastlane -NV

2、建立存储 iOS 签名的 git 仓库,并做适当授权

在 gitlab 上创建如 https://gitlab.xxx.com/ios/certificates 的 git 仓库

3、进入项目工程目录,执行 match init

1
fastlane match init

填入 签名仓库 的 URL 后 会在项目工程目录下生成一个 Matchfile,

打开 Matchfile 填写好前 4 行

4、revoke 老旧无用的证书和签名

1
2
fastlane match nuke development
fastlane match nuke distribution

关于 nuke distribution, 官方指导说:

1
Don't worry, apps that are already available in the App Store / TestFlight will still work.

5、建立 match 用的证书和签名

1
2
3
4
cd ~/Library/MobileDevice/Provisioning\ Profiles 后删除无用的签名
fastlane match development
fastlane match adhoc
fastlane match appstore

该命令是证书安装命令,如果没有则会去创建。

这里会出现一个证书的密码,需要同时告诉其他队员。

6、设置 XCode

1
2
3
a)如无需要,可以删除 XCode Account 里的苹果开发者账号
b)去掉 Automatically manage signing 前面的对勾
c)将工程签名设置成 match 相关的

7、其他人用 步骤1 安装好 fastlane 后,用 步骤5 的命令去安装证书,同时用 步骤6 移除旧管理方式

8、match 证书出现问题的时候一般通过 步骤5 就可以修复。

[注1] fastlane 安装指导:https://docs.fastlane.tools/getting-started/ios/setup/