美文网首页DevOps
在iOS项目中使用Fastlane

在iOS项目中使用Fastlane

作者: 每天多一点 | 来源:发表于2019-01-02 16:53 被阅读14次

安装和使用match可以参考这篇文章
本文旨在介绍在iOS项目使用最新的Fastlane

新建Fast文件

$ fastlane init

之后会提示输入账号和选择团队

安装证书

  • 需要确保自己的证书已经安装到负责编译机器
  • 确认自己的Profile文件已经下载到负责编译的机器

自定义部分

如果在上一个问答的环节选择了上传AppStore,在生成的FastFile中,会有如下的记载:

desc "Push a new release build to the App Store"
  lane :release do
    build_app(workspace: "Enjoy.xcworkspace", scheme: "Enjoy")
    # upload_to_app_store(skip_metadata: true, skip_screenshots: true)
  end

我们需要修改一下:
加入如下的action

desc "Build a dev app"
  lane :dev do
    build_app(
      workspace: "Enjoy.xcworkspace", 
      scheme: "Enjoy",
      configuration: "Debug", #required
      export_method: "development", #required 
      export_options: {
        provisioningProfiles: { 
          "com.milo.myid": "EnjoyProfile_Dev"
        }
      }
    )
  end

简单说明一下:

 configuration: "Debug", #required

configuration 用来提示项目所使用的Profile,默认值是“Release”,会使用其他的provisioningProfiles。

如何确定以上正确的参数呢?可以通过运行fastlane <action> 进行编译(比如,可以直接在fastlane init后运行fastlant release),根据下面这段输出进行试错。

Generated plist file with the following values:
[16:50:14]: ▸ -----------------------------------------
[16:50:14]: ▸ {
[16:50:14]: ▸   "provisioningProfiles": {
[16:50:14]: ▸    "com.milo.myid": "EnjoyProfile_Dev"
[16:50:14]: ▸   },
[16:50:14]: ▸   "method": "ad-hoc",
[16:50:14]: ▸   "signingStyle": "manual"
[16:50:14]: ▸ }
[16:50:14]: ▸ -----------------------------------------

相关文章

网友评论

    本文标题:在iOS项目中使用Fastlane

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