美文网首页工作生活
安装Fastlane并上传到fir.im

安装Fastlane并上传到fir.im

作者: 低调的前行者灬 | 来源:发表于2019-07-01 16:03 被阅读0次

    1. 安装RVM

    1.1 先执行命令
    curl -L get.rvm.io | bash -s stable
    
    1.2 验证
    source ~/.bashrc
    source ~/.bash_profile
    
    1.3 测试安装是否正常
    rvm -v
    

    如果出现 rvm版本号+作者 基本就算是安装RVM成功了。

    2.安装ruby,具体教程自行搜索

    3.安装fastlane

    3.1 bin目录安装fastlane和firim

    加上 -n /usr/local/bin是因为Mac OS X 10.11 已经禁止修改/usr/bin目录了

    sudo gem install fastlane -n /usr/local/bin
    sudo gem install firim -n /usr/local/bin
    
    3.2 fastlane设置
    cd + 工程目录 (xcworkspace或者xcodeproj所在的目录)
    
    fastlane init
    
    WX20190701-154328@2x.png
    其中有一步选择fastlane的用途,如果是一般测试打包选择4
    特殊情况:如果卡在bundle update,首先检查一下自己的本地gem的source源
    gem source -l
    
    *** CURRENT SOURCES ***
    
    https://gems.ruby-china.com/
    

    再确认一下工程目录下生成的Gemfile文件中的gem源是否正常(2019年7月1日记录的source源是https://gems.ruby-china.com/)
    改完上面之后再执行bundle update

    3.3 成功之后安装插件
    fastlane add_plugin versioning
    fastlane add_plugin firim
    中途可能会输入y确认,也有可能输入电脑密码
    
    3.4 打包配置

    打开工程目录下的Fastlane目录下的fastlane文件
    不管原有内容,在上方拷贝如下代码

    desc "archive ipa"
        lane :go do
        #打包的ipa存放路径
        outputDir = "~/firim/ipa/#{Time.now.strftime('%y%m%d')}"
        #打包的ipa名称
        outputName = "JFCommunity-#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}"
        gym(
        scheme: "JFCommunity", #改为你项目的scheme
        workspace: "JFCommunity.xcworkspace",  #如果项目使用CocoaPods需要加上
        #JFCommunity均为对应的工程名
        configuration: "Release",
        output_directory: outputDir,
        output_name: outputName,
        include_bitcode: false,
        include_symbols: true,
        codesigning_identity: ENV["CODESIGNING_IDENTITY_TO_FIRIM"],
        silent: true,
        export_options: {
        method: "development",  #根据具体情况定
        thinning: "<none>"  
        }
        )
        firim(firim_api_token: "fir.im的API token") #上传到firim
        end
    

    如果不上传fir.im的话把最后一句注释掉

    3.5 打包
    fastlane archive
    

    其中archive可以更改为你想要的任何单词
    只需更改Fastfile文件中的配置即可(如下图)


    WX20190701-155847@2x.png

    相关文章

      网友评论

        本文标题:安装Fastlane并上传到fir.im

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