先安裝XCode 命令行工具
xcode-select --install
安裝Fastlane
gem install fastlane -NV
或者
brew cask install fastlane
安裝好成功后便可使用
cd /path/to/project //進入工程的根目錄
fastlane init //初始化配置文件捞慌,會在fastlane文件夾看到以下兩個文件
Appfile //配置工程AppID和AppleID(開發(fā)者賬號)
Fastfile //管理工程的lane的各個action砰奕,可以看成設置的任務流程
一個最簡單的Fastfile打包文件
default_platform(:ios)
platform :ios do
desc "Description of what the lane does"
lane :custom_lane do
# add actions here: https://docs.fastlane.tools/actions
build_app(scheme: "ProjectName")
end
end
然后在該工程根目錄執(zhí)行fastlane custom_lane
便可以執(zhí)行工程的打包,并導出.ipa文件
坑&bug
1、當執(zhí)行fastlane custom_lane
指令的時候,會發(fā)生關于證書報錯的問題
...
Looks like no provisioning profile mapping was provided
...
原因是由于設置證書的問題互艾,由于當前Xcode的版本大多都采用的Automatically 方式牺勾,假如不想手動設置證書青柄,可先archive工程冰评,并上傳或者導入版本映胁,中間Xcode會去自動加載證書。之后重新執(zhí)行命令集索,便可成功屿愚。
2、[Transporter Error Output]: Please sign in with an app-specific password. You can create one at appleid.apple.com. (-22910)
在這里輸入的應為app-specific password(app專用密碼)务荆,在https://appleid.apple.com/account/manage 設置即可