fastlane 打包自动管理证书

2018-11-01  本文已影响38人  iLeooooo
一、安装fastlane

请参考:官方安装指南

$ ruby -v
$ xcode-select --install
// 这么安装会报错,说没有权限,但是在前面加上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 了。

二、项目配置
$ 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文件)。

初始化
source "https://gems.ruby-china.com/"

修改源后,bundle update成功

3
4
app_identifier "com.itachi.demo"    // bundleid
apple_id "xxx@xxx.com.cn"  // apple id
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插件成功

打包成功:


成功
上一篇 下一篇

猜你喜欢

热点阅读