美文网首页
fastlane 打包自动管理证书

fastlane 打包自动管理证书

作者: iLeooooo | 来源:发表于2018-11-01 16:54 被阅读38次
一、安装fastlane

请参考:官方安装指南

  • 1、检查ruby版本 要求大于2.0.0
$ ruby -v
  • 2、检查 Xcode CLT 是否安装
$ xcode-select --install
  • 3、安装fastlane
// 这么安装会报错,说没有权限,但是在前面加上sudo后,发现还是没有权限(`报错`)
$ gem install fastlane -NV 
// 修改为(`ok`)
$sudo gem install -n /usr/local/bin fastlane -NV 

*4、修改UTF-8,配置到处文件的编码格式为UTF-8
/.bashrc、/.bash_profile、~/.zshrc文件中,编辑添加

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

安装成功后就可以为项目配置fastlane 了。

二、项目配置
  • 1、为项目配置 fastlane
$ cd 项目目录
$ fastlane init

初始化时,会出现4个选项:
Automate screenshots(自动化截图)
Automate beta distribution to TestFlight(TestFlight)
Automate App Store distribution (AppStore发布版本)
Manual setup - manually setup your project to automate your tasks(自定义)

直接输入1、2、3、4 选择你想创建的类型
中间会让输入苹果开发者账号和密码,之后会在你项目工程的目录下生成一个fastlane文件夹,里面有Fastlane的配置文件,一个是Appfile文件,一个是Fastfile文件(如果要上传AppStore的话还有Deliverfile文件)。

初始化
  • 选择4,会一直卡在bundle update这里


    image.png

    不修改源成功情形:


    1
    2
  • 此时,关闭终端,打开项目文件夹,修改Gemfile文件里面的源(正常情况)

    修改源
source "https://gems.ruby-china.com/"

修改源后,bundle update成功

3
4
  • Appfile保存苹果开发者的相关信息、项目的相关信息等。
app_identifier "com.itachi.demo"    // bundleid
apple_id "xxx@xxx.com.cn"  // apple id
  • Fastfile是运行脚本。
default_platform(:ios)

platform :ios do
  desc "Description of what the lane does"
  lane :beta do
   // 打包
    build_app(
    // ad-hoc 方式
    export_method: "ad-hoc",
    // 自动管理证书的时候,Xcode 9及以上没有权限获取钥匙串里面的证书,必须加上这个才能打包成功
    export_xcargs: "-allowProvisioningUpdates"
    )
    // 上传pgy,上传之前必须安装pgy的插件
    pgyer(api_key: "fd7fb1d0e6aa1xxxx", user_key: "af42caee1e5cxxxx")
  end
end

运行命令fastlane beta,开始打包
报错1:

pgy插件
解决:安装pgy插件:bundle exec fastlane add_plugin pgyer
安装pgy插件成功

打包成功:


成功

相关文章

网友评论

      本文标题:fastlane 打包自动管理证书

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