fastlane安装流程和fastlane match同步证书和PP文件方法
在每次添加udid时,都需要手动去开发者网站更新PP文件,下载配置到Xcode和更新PP文件到jenkins所有工程。是一个很耗时的操作。
使用fastlane match可在小组成员之间更方便的统一管理证书和PP文件。
分步指南
-
安装fastlane:
① Make sure you have the latest version of the Xcode command line tools installed:xcode-select --install②Choose your installation method:
Homebrew Installer Script Rubygems macOS macOS macOS or Linux with Ruby 2.0.0 or above brew cask install fastlaneDownload the zip file. Then double click on the installscript (or run it in a terminal window).sudo gem install fastlane -NV若brew cask install fastlane安装不成功,可使用sudo gem install fastlane -NV。
如果出现问题,使用方法“Installer Script”,fanqiang下载源文件,点击install安装。
对每个工程配置fastlane(先拉取仓库代码,看同事对某个工程是否已配置好了fastlane,若已配置,只需要执行fastlane pps同步证书和pp文件即可),同步证书和PP文件到证书仓库用命令行进入需要配置的工程目录,执行fastlane init,根据提示输入公司开发者账号dev@xx.com, 和密码(注意:请检查Xcode登录的账号是否是
dev@xx.com
- ,必须用此账号,因为只有此账号有创建PP文件的新增appID的权限)。会自动在工程目录中生成fastlane相关文件。
- 然后把下面代码添加到Fastfile中以下代码的下面
platform :ios do before_all do # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..." #cocoapods #注意,此处必须手动修正:在最左边加#注释掉,否则更新pods可能导致多工程时编译失败。 end
,注意:只需要修改appID为新项目的appIDs(一个工程多个target有不同id的话用中括号括起来,英文逗号分隔)。
在续费账号或每次添加udid时:
管理员在自己电脑上更新证书和pp时;更新方法是进入具体工程目录,然后执行
fastlane pps,成功后可在Xcode上手动指定PP文件。
desc "update profile of appstore,adhoc,dev when udid added or renew dev account"
lane :pps do
match(git_url: "ssh://gitxx/ioscertificates.git",
type: "appstore")
match(git_url: "ssh://gitxx/ioscertificates.git",
type: "development",
app_identifier: ["com.xx"
# , "tools.fastlane.app.today_widget" #Handle multiple targets
],
force_for_new_devices: true)
match(git_url: "ssh://git@git.xx/ioscertificates.git",
type: "adhoc",
app_identifier: ["com.xx"
# , "tools.fastlane.app.today_widget" #Handle multiple targets
],
force_for_new_devices: true)
end
desc "sync profile of appstore,adhoc,dev when admin has update cert and pps"
lane :syn do
match(git_url: "ssh://git@git.xx/ioscertificates.git",
type: "appstore" ,
readonly: true)
match(git_url: "ssh://git@git.xx/ioscertificates.git",
type: "development",
readonly: true)
match(git_url: "ssh://git@git.xx/ioscertificates.git",
type: "adhoc",
readonly: true)
end
非负责人 同步证书和pp文件方法如下:
1.获取最新代码:git pull
2.切到每个具体的子工程目录,用命令行执行:fastlane syn
选做:为了再以后执行 fastlane pps 或 fastlane match development/adhoc/appstor时不再手动输入证书仓库,执行一次
fastlane match init
指定仓库 https://codesigning.guide),会提示成功解密证书仓库。然后会自动创建或导入证书和创建或导入或更新PP文件,
最后会提示成功,信息如下:
fastlane.tools just saved you 11 minutes!
此时dev,adhoc,appstore版本的PP文件都已在开发者网站更新并且自动下载到本地和上传到证书仓库了!
在Xcode中,已经可以手动选择新生成的PP文件了.详见:
https://github.com/fastlane/fastlane/tree/master/match
可能遇到的问题:
1.执行fastlane init时提示: Connection reset by peer - SSL_connect
A:解决办法:
[11:43:54]: - download fastlane at https://download.fastlane.tools
[11:43:54]: -----------------------------------------------------------
[11:43:54]: - extract the archive and double click the `install` 不用想着更新gem或ruby的版本(本身就很麻烦,又慢的要死)。 2.自动生成的开发证书报错,提示未包含某个账号的签名证书。
A:导致的原因是:生成证书的电脑使用的开发者证书和新机器的开发者证书不同,导致此问题。
解决的方法是:删除本地与公用证书账号不同的证书即可。Xcode上就会显示正常了。