In between tests and crazy bug mention, I studied the automatic packaging and uploading of iOS, including the App Store and some third-party platforms like Dandelion. The purpose of this article was to document the problems I had with setting up and using Fastlane. As for how to set up and use Fastlane, the official documentation and online articles are covered in more detail than is needed here.

– the premise

1. Preparation

  1. Register a Developer account
  2. Apply for and download a certificate (preferably both for development and distribution)
  3. Apply and download a Provisioning Profile

2. Configure the project

1. Double-click the installation certificate and configuration file

2. Log in your developer account to Xcode (Provisioning Profile update will be available for download instead of Developer.Apple.com)

3. Select the corresponding configuration file in the project (I do not apply automatic configuration here, as shown in Step 1)

– Environment setup

For reference:

The official documentation

# Fastlane for iOS continuous delivery

– Problems encountered

Problems encountered with fastlane automatic packaging for uploading to App Store Connect.

1. Ruby source is not compatible

Question:
RubyGems is not listed as your Gem source
You can run `gem sources` to see all your sources
Please run the following command to fix this:
$ gem sources --add https://rubygems.org
Copy the code

Solution:
Gem sources --add https://rubygems.orgCopy the code
Analysis:

RubyGems is not listed as your Gem source, so just add another one.

2. Account permissions

Question:
The request could not be completed because:
This request is forbidden for security reasons - The API key in use does not allow this request
Copy the code

Solution:

Developer account permissions set to App Manager or above

  1. Open App Store Connect
  2. Enter users and access

  1. Whether the account set in AppFile file is included in this group, if not, you need to adjust the permission, or change the account

(Also can be higher than this permission, the problem is that because the configured is a developer permission account, so it will be forbidden)

Reference:

Github.com/fastlane/fa…

Github.com/fastlane/fa…

3. The upload fails

Question:
Transporter transfer failed. Please sign in with an app-specific password. You can create one at appleid.apple.com. (-22910) Your account has 2 step verification enabled Please go to https://appleid.apple.com/account/manage and generate  an application specific password for the iTunes Transporter, which is used to upload builds To set the application specific password on a CI machine using an environment variable, you can set the FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD variableCopy the code

Solution 1 :(I use)
  1. Open appleid.apple.com/account/man…
  2. Log in using the account configured in AppFile
  3. Set the App special password, you will get a string of passwords, copy out and save

  1. Go back to the terminal and re-run fastlane Action XXXX (such as upload_to_app_store)
  2. Paste the generated password in the place where you need to input the password, press Enter

Note: Username and password must correspond one by one

Solution 2:

1, 2, 3 ditto

4. Open the fastFile file and set environment variables

Before_all do ENV['FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD'] = 'Specific password' endCopy the code
Analysis:

Double authentication is now enabled for most Apple ids, but fastlane Action requires a special password to skip this step, so you need to go to the Apple ID management interface to generate a special password. The above error occurred because the Apple Id password was mistaken for a special password.

3. Deliver file parameter format

Question:

DeliverFile file:

deliver(
    force: true,
    skip_screenshots: true,
    skip_metadata: true,
    )
Copy the code

Solution:
force true
skip_screenshots true
skip_metadata true
Copy the code
Analysis:

Modifying parameters based on the sample format used in official documents is inconsistent with the actual situation

Pack to the dandelions

Package and release to dandelion is relatively simple, configuration related certificate information, has filled in the key, plus dandelion has written a set of scripts, basically no problem.

Upload App to Dandelion using Fastlane

– the conclusion

The use of Fastlane still has a lot to expand, according to business needs to expand. Everyone has different business needs and different problems. I hope I can provide ideas to students who encounter the same problem. Also, the official documentation must be read, which is the most detailed from the installation -> use.

Thank you very much!