fastlane安装流程和fastlane match同步证书和PP文件方法

在每次添加udid时,都需要手动去开发者网站更新PP文件,下载配置到Xcode和更新PP文件到jenkins所有工程。是一个很耗时的操作。

使用fastlane match可在小组成员之间更方便的统一管理证书和PP文件。

分步指南

          1. 安装fastlane:

              ① Make sure you have the latest version of the Xcode command line tools installed:

               xcode-select --install

              ②Choose your installation method:

            Installer Script
            Rubygems
            macOSmacOSmacOS 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

        1. ,必须用此账号,因为只有此账号有创建PP文件的新增appID的权限)。会自动在工程目录中生成fastlane相关文件。
        1. 然后把下面代码添加到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

指定仓库 ssh://xx.git,会自动生成本地文件Matchfile到fastlane文件夹中,以后执行fastlane match xx 就不会提示输入证书仓库了,也便于以后jenkins相关自动化流程改进。

 执行fastlane pps时如果还让指定证书库地址,指定如下:

 [14:51:50]: To not be asked about this value, you can specify it using 'git_url'

URL to the git repo containing all the certificates: ssh://xx/ioscertificates.git

如果提示输入passphase时,根据提示,两次输入123456(这是第一次创建证书仓库时输入的加密密码,为何创建详见 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:解决办法:

经过测试,还是下面方法在用蓝灯fanqiang的情况下下载靠谱:
  - Use One-Click-Installer:

[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上就会显示正常了。

转载于:https://www.cnblogs.com/Dast1/p/6612928.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值