zoukankan      html  css  js  c++  java
  • fastlane 自动化打包不同的target,以及手动传版本号参数

    fastlane安装及自动化打包在之前的文档中已经详述——fastlane 安装

    一、这里是说明打包不同的target,例如两个target,TestOne和TestTwo,ipa的大小分别是10M和20M。

    主要是修改fastlane相关的Fastfile配置:两个lane对应两个target。

    fasfile文件:

    # This file contains the fastlane.tools configuration
    # You can find the documentation at https://docs.fastlane.tools
    #
    # For a list of all available actions, check out
    #
    #     https://docs.fastlane.tools/actions
    #
    
    # Uncomment the line if you want fastlane to automatically update itself
    # update_fastlane
    
    # 定义打包平台
    default_platform :ios
    
    #指定项目的scheme名称
    output_name=“TestOne”
    output_name_Two=“TestTwo”
    
    platform :ios do
      desc "企业版"
      lane :TestOne do |op|

        #根据输入参version获取app版本号

        increment_version_number(version_number: op[:version]) 

      puts “开始打enterprise ipa”
    
      # 开始打包
      gym(
        scheme: "TestOne",
        #输出的ipa名称
        output_name:”#{output_name}”,
        # 是否清空以前的编译信息 true:是
        clean:true,
        # 指定打包方式,Release 或者 Debug
        configuration:"Release",
        # 指定打包所使用的输出方式,目前支持app-store, package, ad-hoc, enterprise, development
        export_method:"enterprise",
        # 指定输出文件夹
        output_directory:"./fastlane/build",
      )
      end
        lane :TestTwo do
    
        puts “开始打enterprise ipa,SEMF标准版”
    
        # 开始打包
        gym(
        scheme: "TestTwo",
        #输出的ipa名称
        output_name:”#{output_name_Two}”,
        # 是否清空以前的编译信息 true:是
        clean:true,
        # 指定打包方式,Release 或者 Debug
        configuration:"Release",
        # 指定打包所使用的输出方式,目前支持app-store, package, ad-hoc, enterprise, development
        export_method:"enterprise",
        # 指定输出文件夹
        output_directory:"./fastlane/build",
        )
        end
    
    end

    在终端输入fastlane ios TestOne 打包的第一个target的ipa 大小10M

    在终端输入fastlane ios TestTwo 打包的第一个target的ipa 大小20M

    这里有一个问题,就是在打包第二个target的时候有失败,打包出来的还是第一个target只有10M的ipa或者直接失败。

    错误提示会出现

     Couldn't find specified scheme 'TestTwo'.xxxxxx.

    如下图:

    解决方法:

    xcode打开项目,选中scheme,点击Manage scheme,在相应的target后面点击shared。如下图所示:

    勾选之后,点击close。

    在终端输入命令:fastlane ios TestTwo 打包成功ipa大小20M。

    二、版本号问题

    lane : TestOne do |op|

    #根据输入入参version获取app版本号

       increment_version_number(version_number: op[:version]) 

       具体如下图:

      

      打包命令 eg:fastlane TestOne version:1.0.0

  • 相关阅读:
    混合使用UITabBarController和UINavigationController
    基本组件的使用——UITabBarController
    基本组件的使用——UINavigationController
    ios应用程序结构
    让我想起了以前
    如何利用新浪博客做外链1
    如何利用新浪博客做外链
    网站优化之如何更新发布文章
    无线淘宝有600多项加权项
    用代理服务器直接注册小号刷单
  • 原文地址:https://www.cnblogs.com/lulushen/p/9110808.html
Copyright © 2011-2022 走看看