fastlane自动化打包

1. 安装Xcode命令行工具

xcode-select --install

2. 通过rubygem安装fastlane

sudo gem install fastlane

3. 初始化fastlane

cd到工程目录
执行fastlane init
弹出4个选项 \

1. 代表app市场图片素材;
2. 发布到TestFlight进行测试;
3. 发布到App Store;
4. 自定义  

这里选择的4
后面一路enter

4. 自定义gaselane文件

  • Appfile文件
    • app_identifier(“包名”)
    • apple_id(“开发者账号”)
    • team_id(“teamId”) //可以通过打包后DistributionSummary.plist文件内查看 \
  • Fastfile文件
    1
    2
    3
    4
    5
    6
    7
    lane :命令名称 do
    build_app(workspace:"工程名.xcworkspace",
    scheme:"工程名",
    export_method:"development",
    output_directory:"./fastlane/ipadFile",
    configuration:"Debug")
    end

5. 开始打包

cd到工程目录
执行fastlane 命令名称
等待执行完成后可以在./fastlane/ipadFile内查看到打的包

ps

  1. bundle update卡住

    • 检查ruby源
      gem source -l
      如果不是
      https://gems.ruby-china.com/
      运行
      gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/

    • 打开工程中的Gemfile文件
      source "https://rubygems.org"替换为source "https://gems-china.org"

    • 删除fastlane文件夹, 重新执行fastlane init