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
            macOS macOS macOS or Linux with Ruby 2.0.0 or above
            brew cask install fastlane Download 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安裝。

          2. 對每個工程配置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

指定倉庫 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上就會顯示正常了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM