Fastlane 使用

一. 官网:Fastlane  

二. 安装:

1.先安装 Xcode command line tools

           若提示:command line tools are already installed, use "Software Update" to install updates,  则表示已经安装过了。

$ xcode-select --install

2.安装fastlane。

$ sudo gem install fastlane

三. 使用:

1. 初始化 fastlane

    cd到你项目根目录,输入

$ fastlane init

$ fastlane init

[14:51:32]:Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile

[14:51:35]: Detected iOS/Mac project in current directory...

[14:51:35]:This setup will help you get up and running in no time.

[14:51:35]:fastlane will check what tools you're already using and set up

[14:51:35]:the tool automatically for you. Have fun!

[14:51:35]:Created new folder './fastlane'.

[14:51:35]:$ xcodebuild -list -workspace ./xxxx.xcworkspace

Select Scheme:

    这时候会先列出一堆 scheme 让你选择,我们根据需要选择就好。接下来会让你输入你的 Apple ID 和密码

[14:55:22]:Your Apple ID (e.g. fastlane@krausefx.com):

Password (for xxxxx@xxx.com):

完成后 fastlane 会在目录下创建名为 fastlane 的文件夹,包含

fastlane文件夹

   Appfile 中主要存储你的 app_identifier、apple_id和team_id等信息的,里面长这样

app_identifier "com.xxxx.xxxx" # The bundle identifier of your app

apple_id "xxxxx@xxx.com" # Your Apple email address

team_id "xxxxxx" # Developer Portal Team ID

# you can even provide different app identifiers, Apple IDs and team names per lane:

# More information: https://docs.fastlane.tools/advanced/#appfile

再有就是 Fastfile , 它是用来管理 lane 的,每一个 lane 相当于一个任务。初始化后里面已经默认生成 “beta” 和“release”  的 lane ,用于打包测试环境和app store的ipa的。要执行对应的lane,只需在终端cd到项目的根目录:执行fastlane lane'name就可ok了。

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

2.1 安装蒲公英的 Fastlane 插件。

    在终端中,cd 到项目根目录,输入以下命令,即可安装蒲公英的 fastlane 插件。这里会有个坑,需要切换到项目根目录下,不能直接全局安装,具体原因还没有研究,知道的童鞋望告知一下。

fastlane add_plugin pgyer

2.2. 配置蒲公英参数

    插件安装成功后,去修改 Fastfile 里面的 beta 任务,配置一下蒲公英的参数:

lane :beta do

gym(scheme:"你的scheme",

workspace: "你的xcworkspace名称.xcworkspace",

export_method: "ad-hoc")  #这里测试包选择ad-hoc

pgyer(api_key: "蒲公英申请的 api_key",

user_key: "蒲公英申请的 user_key",

update_description: “beta”)  #更新日志

end

     其中gym 是针对于 iOS 编译打包生成 ipa 文件的命令。还有一些其他的命令如: 

match 同步团队每个人的证书和 Provision file 的工具

deliver 用于上传应用的二进制代码,应用截屏和元数据到 App Store

scan 自动化测试工具,很好的封装了 Unit Test

sigh 针对于 iOS 项目开发证书和 Provision file 的下载工具

snapshot 可以自动化iOS应用在每个设备上的本地化截屏过程

    配置完成后,则可以测试下试效果如何,使用:

fastlane beta

    稍等一会,就可以看到成功的信息了。当然 fastlane 的强大不止这一点点。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 更新节点:2019-05-15由于fastlane更新频繁,已更新到 2.105.2 2.122.0更新内容:fa...
    就叫yang阅读 61,909评论 73 146
  • 安装 fastlane的快速上手文档:https://docs.fastlane.tools/这篇文章也不错使用b...
    大大东阅读 1,153评论 0 0
  • Carthage介绍 Carthage 是IOS第三方库的管理工具。相比cocoaPods。可能大家更加熟悉后者。...
    harvey_dong阅读 744评论 0 0
  • Fastlane简介 Fastlane是用Ruby语言编写的一套自动化工具集和框架,每一个工具实际都对应一个Rub...
    小_夭阅读 7,824评论 2 15
  • 终于也懂了,自己之所以会想念她,其实并不是因为她的好,而是因为,之后再也没有一个人可以让我觉得好,怀念的,自始至终...
    未成熟的阅读 553评论 0 1