Joseph O'Shea

Make it easy to ship TestFlight builds of your iOS app with fastlane

fastlaneiostestflight

Setting up fastlane

This post covers how to use fastlane to ship beta builds of your iOS app to TestFlight.

This post is intentionally light on details and explanations. Instead, it focuses on taking the simple, direct path to getting your builds running.

If you'd like to learn more about the details behind this guide, I'd suggest reading:

Prerequisites

Fastlane requires:

Please see the fastlane docs for more details.

Install fastlane and configure beta builds

  1. Create a Gemfile with these contents:

    source "https://rubygems.org"

    gem "fastlane"
  2. Install fastlane with bundler

    bundle install
    
  3. Initialize your fastlane config

    bundle exec fastlane init
    
  4. When prompted, choose option 2. Automate beta distribution to TestFlight

  5. When prompted, enter your Apple ID and log in.

  6. If you have more than one team, you will be asked to select which to use for this project.

Setup fastlane match for codesigning:

  1. Initialize fastlane match config for codesigning

    bundle exec fastlane match init
    
  2. Choose git

  3. Create a private git repo and paste the URL into the fastlane prompt

  4. Sync your appstore (production) codesigning

    bundle exec fastlane match appstore
    
  5. You will be prompted for a passphrase. This is the key to unlock your signing certs and should be kept secret! I highly recommend using a password manager to store this.

  6. Sync your development codesigning

    bundle exec fastlane match development
    
  7. Go into xcode, and disable "automatic manage signing". Then select the "match" profile for each of the options (debug and release).

You are all set! If you get stuck or run into any problems, take a look at the fastlane match docs for help.

Using fastlane

To publish a TestFlight build, run:

bundle exec fastlane beta

You may be prompted to authenticate with your developer account during the process.

The build may take a significant amount of time depending on your app. Building my react native app typically takes 15-30 minutes on my laptop.

Possible errors during setup

["Apple provided the following error info:", "Access Unavailable", "You currently don't have access to this membership resource. To resolve this issue, agree to the latest Program License Agreement in your developer account."]

  1. Go to https://appstoreconnect.apple.com/
  2. Log in with your Apple ID
  3. Accept the new developer agreement
  4. Try again