1.打開終端,確保Xcode Command Line Tools
安裝了最新版api
xcode-select --install |
2.安裝fastlanexcode
sudo gem install -n /usr/local/bin fastlaneruby |
查看源 gem sources -l 卡住不動,可能Ruby的源被牆了,服務器
移除源 gem source -r https://rubygems.org/ (剛纔查看到的源)
app
添加源 gem source -a https://gems.ruby-china.comide
備註:https://gems.ruby-china.org 域名改了要用.com 網站
3.CD到工程目錄初始化spa
fastlane init |
初始化的過程當中會出現下面的選項:插件
What would you like to use fastlane for?code
1. Automate screenshots
2. Automate beta distribution to TestFlight
3. Automate App Store distribution
4. Manual setup - manually setup your project to automate your tasks
第一個:截圖
第二個:發佈到TestFlight
第三個:發佈到App Store
第四個:手動設置
咱們選擇4,enter
安裝成功會在工程根目錄下生成fastlane文件, 包含Appfile和Fastfile配置文件
4.配置Appfile
app_identifier 包名
apple_id 蘋果開發者帳號
5.配置Fastfile
DemoTest爲工程名稱
若是工程用了CocoaPods,切記須要配置workspace這個參數,沒有用的話,去掉workspace這行便可
firim_api_token: '***************'
firim_api_token 你在firim網站登陸後,點擊頭像,能夠查看API token。複製到這地方
備註:若是是蒲公英平臺,將firim這行替換爲如下蒲公英的配置便可。 pgyer(api_key: "************", user_key: "***********")
其中的 api_key
和 user_key
,請開發者在本身帳號下的 應用管理
- App概述
- API
中能夠找到,並替換到以上相應的位置。
desc下面的lane後面的 archive 這個方法名能夠自由配置,一會發布到firim須要調用此方法。
desc "ipa打包" lane :archive do |
釋義:
6.安裝fir插件
fastlane add_plugin firim |
備註:若是是蒲公英平臺須要輸入 fastlane add_plugin pgyer
7.發佈到firim
fastlane archive |
命令執行完成後, 能夠在Fastfile文件output_directory參數配置的目錄下找到自動生成的ipa文件,和dYSM的壓縮包(若是configuration配置的是Debug,就不會有dYSM的壓縮包)