iOS Choose a packaging method that suits you and Fastlane automatically packages and uploads it

There are a lot of projects on hand recently, and often packaging and releasing them is cumbersome, so I have to choose a way to improve work efficiency.

There are several packaging methods commonly used at present.

1. Xocde basically packages and uploads the app store. This does not rely on other plug-ins and can be completed by following the instructions step by step. Needless to say;

2. Application loader: First use Xcode to package the Ipa file and then upload it with this tool. Generally, company operation and maintenance uses this method, which separates development and release for easy management;

3.altool: A plug-in from Apple that automatically packages and uploads to the app store. It is simple and convenient to operate. You can complete the operation with just two lines of commands. However, it is also obvious that we cannot set parameters and can only upload to the app store. This has great limitations. Not many people are currently using it;

4. Use third-party integrated plug-ins or script language packaging: such as Fastlane, Jenkins, shell scripts and python scripts. I have made a simple comparison of these. The first two are integrated tools that require a lot of initial work to use, but they need to be interpreted after they are set up. It is clear and convenient, and grouping actions allows us to do it once and for all. As for the script language, everyone must know that it is light and fast, but the script is directly added to the program unlike the integrated tool, which is separated and the configuration is not so clear. I think the project It is best not to mix these into the packaging. Of course, these methods have their own advantages and disadvantages. You can try them all and choose the packaging method that suits you best.

Let’s briefly talk about Fastlane

Fastlane GitHub address: Fastlane.github address
Detailed introduction: Document address

Fastlane  is an automated build tool for iOS and Android developers. It can help developers completely connect App packaging, signing, testing, publishing, information sorting, submission to the App Store and other tasks to achieve a fully automated workflow. , if used properly, can significantly improve the development efficiency of developers.

Preconditions

  1. Developers use mac or linux systems

  2. Ruby, rubygems, and bundler have been installed

  3. Fastlane is already installed. If not installed

  4. Developers understand the basic App development process and how to use the terminal  

Installation method 

Make sure the latest version of Xcode Command Line Tools is installed
. Terminal input:

xcode-select --install

Terminal to the current folder of the project to
initialize fastlane 

fastlane init

You need to enter your Apple ID and password (you can add it with confidence, the account and password are encrypted)
fastlane will automatically detect the APP name and App identifier of the current directory project. If the detection is incorrect, select n and enter it yourself.

A fastlane file will be created in the current directory

Edit Fastfile

default_platform(:ios)

platform :ios do
  desc "发布到蒲公英"
  lane :pgy do
  	gym(
    	clean:true,	# 是否清空以前的编译信息
    	scheme:"xxx",	# 自己项目名称
    	export_method:"development",# 可选的值有:app-store、ad-hoc、development、enterprise。
    	configuration: "Debug",	# 环境(Debug、Release)
    	output_directory:"./build",	# 打包后的 ipa 文件存放的目录
    	)
	pgyer(
    	api_key: "4f7c55a076b93de8b36d1f601086ee6a", 
    	user_key: "25bf5e05d4e325c1a9a8c688a0e3aa82", 
    	update_description: "fix something"
    	)
  end
  desc "上传新版本到 App Store"
  lane :release do
    gym(
    clean:true,
    scheme:"xxx",
    export_method:"app-store",# 可选的值有:app-store、ad-hoc、development、enterprise。
    export_xcargs: "-allowProvisioningUpdates",	# 访问钥匙串
    output_directory:"./build",
    )
    deliver(
    submit_for_review: false # 是否提交审核,true表示立马提交审核
    )
  end
end

Enter the project directory and execute the command

fastlane pgy

Upload to Dandelion

The one below is the Action uploaded to the APP Store

In this way, you can directly set up several action groups, and just enter the corresponding command each time, once and for all.

Guess you like

Origin blog.csdn.net/PianZhideNanRen/article/details/103346166