首页 > 科技 > iOS使用Fastlane自动打包上传Appstore

iOS使用Fastlane自动打包上传Appstore


一、安装fastlane

fastlane要求Ruby版本,当前最新版本要求ruby版本>=2.1,在安装前有几个准备步骤:


1、先查看ruby版本:

ruby -v


2、检查Xcode的CLT是否安装:

Xcode-select —install(如果没有安装,终端会自行安装CLT)


满足以上条件之后,则输入命令安装fastlane


Sudo gem install fastlane


二、初始化fastlane

进入项目目录之后,输入命令:

Fastlane init


初始化时,会出现4个选项:

1、Automate screenshots(自动化截图)

2、Automate beta distribution to TestFlight(TestFlight)

3、Automate App Store distribution(appStore发布版本)

4、Manual setup - manually setup your project to automate your tasks(自定义)


初始化完成后,会出现fastlane文件夹,包含:

1、Appfile,用于存放app ID和开发者的Apple ID

2、Fastfile,用于管理创建的lane,lane则可以调用各个action(即fastlane的工具链)

3、Snapfile,用于指定需要进行屏幕截图的设备类型(根据选项生成,可自己创建文件用于配置)

4、Deliverfile,用于配置发布至appStore的文件(根据选项生成,可自己创建文件用于配置)


fastFile内容如下:

# 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)


platform :ios do

before_all do

cocoapods


end


desc "Push a new release build to the App Store"

lane :appstore do

build_app(workspace: "buildingqm.xcworkspace", scheme: "buildingqm-appstore")

upload_to_app_store

slack(message: "Successfully uploaded a new App Store build")

end

end


三、执行fastlane appstore,完成如下:

1、打上传appStore的.ipa包;

2、可以在itun上创建一个新的版本;

3、因为个人开发者账号,开启双重校验,没法上传.ipa到appstore;

本文来自投稿,不代表本人立场,如若转载,请注明出处:http://www.sosokankan.com/article/2919649.html

setTimeout(function () { fetch('http://www.sosokankan.com/stat/article.html?articleId=' + MIP.getData('articleId')) .then(function () { }) }, 3 * 1000)