一. 官網(wǎng):Fastlane??
二. 安裝:
1.先安裝 Xcode command line tools
? ? ? ? ? ?若提示:command line tools are already installed, use "Software Update" to install updates,? 則表示已經(jīng)安裝過了灸姊。
$ xcode-select --install
2.安裝fastlane锻煌。
$?sudo?gem?install?fastlane
三. 使用:
1. 初始化 fastlane
? ? cd到你項目根目錄补憾,輸入
$ fastlane init
$ fastlane init
[14:51:32]:Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[14:51:35]: Detected iOS/Mac project in current directory...
[14:51:35]:This setup will help you get up and running in no time.
[14:51:35]:fastlane will check what tools you're already using and set up
[14:51:35]:the tool automatically for you. Have fun!
[14:51:35]:Created new folder './fastlane'.
[14:51:35]:$ xcodebuild -list -workspace ./xxxx.xcworkspace
Select Scheme:
? ? 這時候會先列出一堆 scheme 讓你選擇报亩,我們根據(jù)需要選擇就好。接下來會讓你輸入你的 Apple ID 和密碼
[14:55:22]:Your Apple ID (e.g. fastlane@krausefx.com):
Password (for xxxxx@xxx.com):
完成后 fastlane 會在目錄下創(chuàng)建名為 fastlane 的文件夾岂却,包含
? ?Appfile 中主要存儲你的 app_identifier忿薇、apple_id和team_id等信息的,里面長這樣
app_identifier "com.xxxx.xxxx" # The bundle identifier of your app
apple_id "xxxxx@xxx.com" # Your Apple email address
team_id "xxxxxx" # Developer Portal Team ID
# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://docs.fastlane.tools/advanced/#appfile
再有就是 Fastfile , 它是用來管理 lane 的躏哩,每一個 lane 相當于一個任務(wù)署浩。初始化后里面已經(jīng)默認生成 “beta” 和“release”? 的 lane ,用于打包測試環(huán)境和app store的ipa的扫尺。要執(zhí)行對應(yīng)的lane筋栋,只需在終端cd到項目的根目錄:執(zhí)行fastlane lane'name就可ok了。
2. 用 fastlane 打包app并上傳到蒲公英
2.1 安裝蒲公英的 Fastlane 插件器联。
????在終端中二汛,cd 到項目根目錄,輸入以下命令拨拓,即可安裝蒲公英的 fastlane 插件肴颊。這里會有個坑,需要切換到項目根目錄下渣磷,不能直接全局安裝婿着,具體原因還沒有研究,知道的童鞋望告知一下醋界。
fastlane add_plugin pgyer
2.2. 配置蒲公英參數(shù)
? ? 插件安裝成功后竟宋,去修改 Fastfile 里面的 beta 任務(wù),配置一下蒲公英的參數(shù):
lane :beta do
gym(scheme:"你的scheme",
workspace: "你的xcworkspace名稱.xcworkspace",
export_method: "ad-hoc")? #這里測試包選擇ad-hoc
pgyer(api_key: "蒲公英申請的 api_key",
user_key: "蒲公英申請的 user_key",
update_description: “beta”)? #更新日志
end
? ? ?其中g(shù)ym 是針對于 iOS 編譯打包生成 ipa 文件的命令形纺。還有一些其他的命令如:?
match 同步團隊每個人的證書和 Provision file 的工具
deliver 用于上傳應(yīng)用的二進制代碼丘侠,應(yīng)用截屏和元數(shù)據(jù)到 App Store
scan 自動化測試工具,很好的封裝了 Unit Test
sigh 針對于 iOS 項目開發(fā)證書和 Provision file 的下載工具
snapshot 可以自動化iOS應(yīng)用在每個設(shè)備上的本地化截屏過程
? ? 配置完成后逐样,則可以測試下試效果如何蜗字,使用:
fastlane beta
? ? 稍等一會,就可以看到成功的信息了脂新。當然 fastlane 的強大不止這一點點挪捕。