1.首先确定是否安装了xcode的命令行工具
xcode-select --install
如果出现这个提示,证明已经安装过xcode的命令行工具

如果出现这个

安装fastlane的步骤
1.安装fastlane
sudo gem install fastlane -NV
如果在安装时候提示404,因为镜像数据源变了,需要进行修改,如果没有提示404可以忽略这个步骤
①查看现在的镜像
gem sources -l
②移除这个这个镜像
gem source --remove https://gems.ruby-china.org/
③添加新的镜像
gem source -a https://gems.ruby-china.com/
2.切换到工程目录初始化
fastlane init
3.初始化的过程中会出现下面的选项:

第一个选项的意思是:自动截屏。这个功能能帮我们自动截取APP中的截图,并添加手机边框(如果需要的话)
第二个选项的意思是:自动发布beta版本用于TestFlight
第二个选项的意思是:自动发布到AppStore
第二个选项的意思是:手动设置
我在这里选的是第四个(大家可根据自己需要选择),截图如下:

紧接着一直点击enter键,知道安装成功会出现如下截图

安装成功之后,会在我们的工程目录生成一个fastlane文件夹:目前应该只包括最上面两个文件夹,下面的是自动打包后才会出现的

然后此时,我们需要自己编辑Appfile和Fastfile两个文件:
首先看Appfile文件,我的如下:添加自己项目的bundleID,appleID,teamID

修改Fastfile文件,lane:后面的betaProduct是自己定义的,等会打包命令时候会需要的,只要打包命令和这个值一样就可以,pgyer是用来上传蒲公英来使用的,如果是想只打包不上传可以不写这个句

然后就可以直接打包,这个命令就是Fastfile里面定义的名字,然后在工程目录下的fastlane文件夹中的package文件夹中就可找到自动打包出来的ipa和符号表了
fastlane betaDebug
安装蒲公英的 Fastlane 插件
在终端中,输入以下命令,即可安装蒲公英的 fastlane 插件。
fastlane add_plugin pgyer
在fastfile文件中配置好蒲公英的apikey和userkey后就可以直接上传到蒲公英了,再次执行这个命令
fastlane betaProduct
网友评论