文章導圖
fastlane的準備工作
方式一:appleID雙重驗證
1)安裝:sudo gem install fastlane
2)項目目錄下初始化:fastlane init
3)選擇方式(此處選3):
4)輸入appleID和密碼:
5)輸入雙重驗證碼:
參考:fastlane doc
方式二:APP專用密碼
1)登錄appleID生成apple專用密碼
2)安裝:sudo gem install fastlane
3)配置APP專用密碼(設置環(huán)境變量的方式):export FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=XXX
4)項目目錄下初始化:fastlane init
參考:support. apple
具體項目使用
1沛豌、自動上傳到appstore
1)切換到項目根目錄咧七,執(zhí)行fastlane ios
3)fastlane會自動生成appstore的信息,包括截圖等芋酌。此時須確認
4)成功后的顯示
5)提示信息:在fastlane打包和上傳的過程中,會向賬戶發(fā)提示信息
遇到的問題:
bundle update太慢
miss copyright date
Invalid Bundle
CFBundleVersion must be higher than previous version
2、自動上傳到pgyer
注:前置條件
1. 開發(fā)者使用的是 mac 或 linux 系統(tǒng)
2. 已經安裝好 ruby绷落、rubygems卸例、bundler
3. 已經安裝了 Fastlane称杨。
4. 開發(fā)者了解基本的 App 開發(fā)流程肌毅、終端的使用方法
5. 本文使用環(huán)境為:macOS 10.13, Xcode 9.2, Fastlane 2.78.0, fastlane-plugin-pgyer 0.2.1
1)安裝蒲公英的 Fastlane 插件,在終端輸入fastlane add_plugin pgyer
2)找到pgyer的api_key和user_key(應用管理 - App概述 - API )
3)將api_key和user_key加入到項目下的fastlane/Fastfile文件中
lane :beta do
build_app(export_method: "ad-hoc")
pgyer(api_key: "194f1defc84cc4cc64f081e470059d16", user_key: "60ac7820088e473277790a0184e609de")
end
4)命令行中輸入fastlane beta即可
備注:可在發(fā)布時設置密碼(在fastfile文件中添加password和install_type:"2"字段)
lane :beta do
build_app(export_method: "ad-hoc")
pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", user_key: "4a5bcxxxxxxxxxxxxxxx3a9e", password: "123456", install_type: "2")
en
遇到的問題
成功上傳到pgyer后姑原,有可能安裝包無法安裝悬而。此時是因為導出選項沒有勾選。在lane中設置export_method:"development"即可页衙。
lane :beta do
build_app(workspace: "ProjectManagement.xcworkspace", scheme: "ProjectManagement")
gym(
export_method:"development"
)
pgyer(api_key: "19xxxxxxxxxxxxx6", user_key: "60acxxxxxxx09de")
end
腳本方式
1) 下載Shell腳本
2)將archiveScrip中的幾個文件拖入到工程根目錄
3)根據自己的需求配置shell.sh
文件 | 修改項 | 備注 | 行號 | 圖示 |
---|---|---|---|---|
shell.sh | project_name | 工程名 | 12 | |
shell.sh | scheme_name | scheme名 | 15 | |
shell.sh | -u XXX -p XXX | appleID賬號 | 109和110四處 | |
exportAppstore.plist | FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD | app專用密碼 | 略 |
4)cd到工程根目錄摊滔,通過./shell.sh執(zhí)行腳本即可
結:
不管哪種方式 ,并沒有省去打包的時間店乐,只是將打包和上傳到appstore的步驟自動化艰躺。省去了中間過程的交互時間。