美文网首页
2018-05-19 fastlane集成与使用

2018-05-19 fastlane集成与使用

作者: 白云心城 | 来源:发表于2018-05-20 11:18 被阅读0次

1.环境安装

1.确定ruby是否安装,使用ruby -v 查看ruby版本

ruby -v

2.安装Xcode命令行工具,使用如下命令进行安装

xcode-select --install

如果出现

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

代表已安装,否则根据提示进行操作即可安装

3.安装fastlane,使用如下命令进行安装,安装需要一点等待时间

sudo gem install fastlane

2.使用fastlane打包并上传到蒲公英

1.安装蒲公英插件,在终端中输入如下命令进行安装

fastlane add_plugin pgyer

出现如下信息说明安装成功


安装蒲公英插件

2.初始化
切换到Xcode工程目录下面,使用如下命令进行初始化

fastlane init

初始化过程中会出现以下选项,目前使用的是第4个选项

[15:52:35]: What would you like to use fastlane for?
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
1.自动截屏(暂未使用)
2.自动发布测试版本到 TestFlight
3.自动发布到App Store
4.手动配置    

初始过程中会出现一些提示,根据提示信息一直按Enter键就好了,初始完成后的打印信息如下

[16:03:36]: ------------------------------
[16:03:36]: --- Where to go from here? ---
[16:03:36]: ------------------------------
[16:03:36]: 📸  Learn more about how to automatically generate localized App Store screenshots:
[16:03:36]:         https://docs.fastlane.tools/getting-started/ios/screenshots/
[16:03:36]: 👩‍✈️  Learn more about distribution to beta testing services:
[16:03:36]:         https://docs.fastlane.tools/getting-started/ios/beta-deployment/
[16:03:36]: 🚀  Learn more about how to automate the App Store release process:
[16:03:36]:         https://docs.fastlane.tools/getting-started/ios/appstore-deployment/
[16:03:36]: 👩‍⚕️  Learn more about how to setup code signing with fastlane
[16:03:36]:         https://docs.fastlane.tools/codesigning/getting-started/
[16:03:36]: 
[16:03:36]: To try your new fastlane setup, just enter and run
[16:03:36]: $ fastlane custom_lane

初始化完成后会在项目目录下生成一些文件,如下图


完成初始化

3.设置配置文件 Fastfile
然后,找到在用的工作流(action),在 build_app 指令后,加入蒲公英插件的配置信息

lane :beta do
  build_app(export_method: "ad-hoc")
  pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", user_key: "4a5bcxxxxxxxxxxxxxxx3a9e")
end

注意:

  1. 以上的 api_key 和 user_key,在自己账号下的 应用管理 - App概述 - API 中可以找到,并替换到以上相应的位置。
  2. 在 Xcode 8.3 和 Xcode 8.3 以后的版本中,对于 build_app 的 export_method 的值,需要根据开发者的打包类型进行设置,可选的值有:app-store、ad-hoc、development、enterprise。对于 Xcode 8.3 以下的版本,则不需要设置 export_method。

4.完成以上配置后在终端中输入以下命令就可以使用了

fastlane beta

相关文章

网友评论

      本文标题:2018-05-19 fastlane集成与使用

      本文链接:https://www.haomeiwen.com/subject/zcxadftx.html