One, foreword

For us iOS developers, one of the most tedious things to do is to pack up the shelves, which is tedious and time consuming. So are there tools that will liberate us?

Yes, the answer is Fastlane. Fastlane is a scripting tool for mobile App development.

The easiest way to build and release mobile apps. fastlane handles tedious tasks so you don’t have to.

This paper simply realized the automatic upload of IPA to AppStore by Fastlane, and more branches and leaves need to be improved gradually by myself.

The basic steps are as follows: 1. Install Fastlane 2. Initialize Fastlane 3

After the initial configuration, you only need to execute FastLane Release to upload to the App Store with one click.

Install Fastlane

sudo gem install fastlane

Check whether the installation is successful:

fastlane --version

Fastlane initialization

CD Go to the project directory and run fastlane init. Several interactive prompts follow.

What do you use Fastlane for?

We chose option 3: automatic upload to the AppStore.

2. During the period, you need to enter your Apple ID account and password, and initiate a two-step verification.

Enter your account number:

Enter the two-step verification code:

3. Do you use Fastlane to manage app metadata?

Select Y to manage metadata locally as a file. For example, title, description, screenshot, etc.

Then press Enter to complete the initialization.

4. Configure the certificate and description file

fastlane match init

1. Choose how to store your certificate and description file. I choose 1 and use Git.

You will be prompted to enter the Git address where you want to store your files. You can just hit Enter, you don’t have to type.

At this point, the certificate and description file are successfully configured.

Five, fastfile content introduction

Now, open your project root directory and you will find a fastlane folder.

Appfile: basic App information. For example, bundleId, teamId, and appleId. Fastfile: Each Fastfile defines a set of operations (channels). Metadata: Indicates metadata. Same as the AppStore Connect. This is just a local copy. Screenshots: Store introduction map.

Here are the contents of the Fastfile file:

default_platform(:iOS)

platform :iOS do
  desc "Push a new release build to the App Store"
  lane :release do
    increment_build_number(xcodeproj: "KDOHInternational.xcodeproj")
    build_app(workspace: "KDOHInternational.xcworkspace", scheme: "KDOHInternational")
    upload_to_app_store
  end
end
Copy the code

Increment_build_number: automatically increments Build number (Build number); build_app: automatically increments Build number (Build number); upload_to_app_store: Upload ipA to app Store

Six, one-click upload

Once you’ve done all the configuration above, you can upload it with one click. Go to your project root directory (where the Fastlane folder is located) and the terminal executes:

fastlane release

There are some hints and confirmation options in the middle of the process, just confirm it. The following errors may occur when the IPA package is uploaded:

Need to enter App specific secret key:

We are in the specified page: appleid.apple.com/account/man… Create the Apple authentication key and type it into the terminal.

Upload successful! You will see the package uploaded on AppSore Connect in about ten minutes.

Seven,

Fastlane has really brought us mobile developers a lot of convenience by converting everyday manual operations into simple scripts. For those of you who haven’t tried it, try it!