一、安装fastlane
1.打开终端输入命令
xcode-select --install
2.查看当前ruby版本
ruby -v
3.安装fastlane
sudo gem install fastlane -NV
如上一步提示' You don't have write permissions for the /usr/bin directory.
'执行以下命令安装
sudo gem install fastlane -NV -n /usr/local/bin
4.安装成功之后查看版本
fastlane -v
二、使用fastlane
1.初始化 cd到项目跟目录下
fastlane init
执行init之后 会有四个选项供选择,笔者选了第四个选项来自定义指令进行操作,选择之后会卡在bundle update这个地方,这里其实已经init完成了
2.编辑Appfile文件
app_identifier("项目bundleID") # The bundle identifier of your app
apple_id("开发者账号") # Your Apple email address
3.编辑Fastfile文件
default_platform(:ios)
platform :ios do
desc "Description of what the lane does" # 这个是指令的描述,可根据需要改动
lane :archive do # archive 是命令的名称 执行的时候直接命令行输入 fastlane archive 便会执行该条命令,可根据需求自己编辑
# add actions here: https://docs.fastlane.tools/actions
gym(
clean:true,
scheme:"TestProject", # 项目名
configuration:"Debug", # Debug, Release
export_method:"development", # appstore, ad-hoc, package, enterprise, development, developer-id
output_directory:"/Users/a111/Desktop/ipa", # 安装包导出路径,需设置成自己设备上的路径
)
# 上传到蒲公英 api_key 与 user_key 请移步蒲公英api信息处查看
# 需在项目根目录处安装蒲公英插件 fastlane add_plugin pgyer
pgyer(api_key: "a313ea0985c3de6733e8a2803ed04323", user_key: "db16a67cd77d1fd4dbd4d2e6b5a12a55", update_description: "第一次打包啦啦啦啦")
end
end
3.1 如果是打包上传到apphost,可以用以下命令
system("curl --form plat_id=你的id --form token=你的token --form file=@安装包路径 上传地址")
4.执行打包上传命令 archive 为你创建的指令名,与上边的配置对应
fastlane archive
网友评论