Skip to content

iOS Builds

Build and submit iOS apps to TestFlight and the App Store using Capgo’s dedicated Mac infrastructure.

  • You will learn how to upload your app via Capgo Native build
  • You will learn how to configure the certificates for Capgo Native Build
  • A Capgo account with an active subscription
  • Your app already registered in Capgo (run npx @capgo/cli@latest app add if not)
  • A Mac computer with Xcode installed (it’s possible to setup the build on a linux/windows machine, but it’s not yet documented)
  • Valid Apple Developer account ($99/year) (You must have admin or owner rights on the Apple Developer account)
  • Your app must be able to build successfully via Xcode
  • A Capacitor app
  • A configured icon for the app. Apps without an icon cannot be uploaded to the App Store.

Before we can start thinking about building the app with Capgo, we should first set it up, and do a first TestFlight build by hand. There are some advantages to doing a manual build first:

  • You will setup the distribution certificate on your local machine
  • You will create the App Store record if you haven’t done it yet
  • You will be able to figure out any issues with the build process linked to your app code

Before we can begin, you must have the distribution certificate installed on your local machine. This is quite a bit complex, but I will explain it below.

  1. Open Xcode

  2. Click on Xcode -> Settings... Alternatively, you can use the shortcut Cmd + ,

    Xcode settings

  3. Go to Accounts Xcode Accounts tab

  4. Find the Apple Account that is added to the Apple Developer Account Xcode selected apple account

  5. Find the team that you will use to deploy the app Xcode find team

  6. Click on the Manage Certificates... button Xcode manage certificates

  7. Make sure you can see the distribution certificate in the list Xcode distribution certificate

  8. If you do not, you need to create a new certificate

    1. Click on the + button and then on Apple Distribution Xcode add certificate
    2. The certificate will be created automatically. You can see it in the list. Look at the previous step to confirm that you see it.

Now that you have the distribution certificate installed, you can begin the build process.

  1. Open the app in Xcode

    Run npx cap open ios to open the app in Xcode.

  2. Find and click on the archive button

    In the Xcode toolbar, find and click on the product -> archive button.

    Xcode toolbar

  3. Wait for the build to complete

  4. Click on the Distribute App button

    Xcode distribute button

  5. Select TestFlight Internal Only as the distribution method and click on Distribute button

    Xcode TestFlight internal only distribution method

  6. Configure the app record

    Fill in the following fields:

    1. Name: The name of your app - visible in the App Store
    2. SKU - the SKU of your app - this is used to identify your app in the App Store
    3. The primary language - the primary language of your app

    Then, click on the next button

    Xcode TestFlight configure app record

  7. If the creation of the app record fails, try to close the window and try to archive the app again.

  8. Wait for the upload to complete

  9. If everything went well, you should see the following screen Xcode TestFlight upload complete

  10. Click on the Done button

You may instinctively think that all is good now and that you will be able to see your app in TestFlight now, but there are a few more things needed to be done before you can see your app in TestFlight:

  1. You need to add yourself to TestFlight
  2. You need to promise Apple that your app doesn’t use any non-standard (like a custom algorithm) encryption. If your app does use any non-standard encryption, I suggest reading the Apple documentation on how to handle this.

Let’s start with the first one:

  1. Go to the App Store Connect page App Store Connect login page

  2. Sign in with your Apple Developer account

  3. Select the team that you used when you created the app record. If you are only in one developer account, can skip this step. App Store Connect team selection

  4. Click on the Apps button App Store Connect apps button

  5. Find the app you created in the previous step and click on it App Store Connect app selection

  6. Click on the TestFlight button App Store Connect testflight button

  7. Click on the Internal Testers plus button App Store Connect internal testers plus button

  8. Create a new group

    I like to name the group “internal”. You can name it whatever you want.

    App Store Connect create new group

  9. Click on Invite testers button App Store Connect invite testers button

  10. Add yourself to the group

    Find yourself in the list and select the checkbox next to your name. (You may need to refresh the page to see yourself) Then, click on the Add button.

    App Store Connect invite tester checkbox

  11. Verify that you are added to the group

    Now, you should see yourself in the group.

    App Store Connect verify tester

Congratulations 🎉 You have added yourself to TestFlight. Now, there is just one more thing you need to do before you can configure Capgo Native Build.

You now need to promise Apple that your app doesn’t use any non-standard (like a custom algorithm) encryption. If your app does use any non-standard encryption, I suggest reading the Apple documentation on how to handle this. There are two ways to do this:

  1. You can do this by hand every time you build your app.
  2. You can configure your plist file to automatically set this value to false.

Let’s start with the first one:

  1. Follow all the steps from the previous section to find the TestFlight section in App Store Connect

  2. Click on Builds -> iOS App Store Connect builds iOS button

  3. Find the build with missing compliance information and click on Manage App Store Connect manage build

  4. Select the option that best describes your app

    For me, this is none, but it might be different for you. After, click save

    App Store Connect save compliance information

  5. Your app should now say ready to test

    App Store Connect ready to test

As for the second one, here are the steps:

  1. Open the Info.plist file

  2. Add the following key:

    <key>ITSAppUsesNonExemptEncryption</key>
    <false/>
  3. Save the file

Installing the TestFlight app and accepting the invitation

Section titled “Installing the TestFlight app and accepting the invitation”

Now, you are ALMOST ready to test your app in TestFlight. Before, you need to do the following things:

  1. Download the TestFlight app from the App Store on your iOS/iPadOS device
  2. Accept the invitation to test your app

I will skip the details of how to install the TestFlight app on your device. If you are not sure how to install an app, Google has some great guides on how to do it.

As for accepting the invitation, you will receive an email from Apple with a link to accept the invitation.

  1. Open the email from Apple with the link to accept the invitation

  2. Click on View in TestFlight button TestFlight email button

  3. Click on the Install button TestFlight install button

  4. Install the app on your device

    If you have installed the app previously using Xcode, you may see the following screen. Please click on the install button. TestFlight install app

  5. Wait for the app to install

  6. Click on the Open button and click it

Congratulations 🎉 You have accepted the invitation to test your app in TestFlight. Now, you can configure Capgo Native Build to build and submit your app to TestFlight.

There are a few things you need to configure in Capgo Native Build to be able to build and submit your app to TestFlight. Here is a list of the things you will pass to the Capgo CLI:

ParameterDescription
--platformThe platform to build for (ios)
--apple-team-idYour Apple Developer Team ID (found in Apple Developer Portal)
--apple-keyPath to your App Store Connect API Key file (.p8 file)
--apple-key-idThe Key ID of your App Store Connect API Key
--apple-issuer-idYour App Store Connect Issuer ID
--certificatePath to your distribution certificate (.p12 file)
--provisioning-profilePath to your provisioning profile (.mobileprovision file)
--apple-profile-nameThe name of your provisioning profile

Example command:

Terminal window
npx @capgo/cli@latest build credentials save \
--platform ios \
--apple-team-id YOUR_TEAM_ID \
--apple-key '/path/to/AuthKey_XXXXX.p8' \
--apple-key-id YOUR_KEY_ID \
--apple-issuer-id YOUR_ISSUER_ID \
--certificate '/path/to/certificate.p12' \
--provisioning-profile '/path/to/profile.mobileprovision' \
--apple-profile-name your-profile-name

Let’s start with the team ID. Finding it is quite easy.

  1. Go to Apple Developer Account and scroll down

  2. Find the Team ID

    Team ID location in developer account

Apple key, Apple key ID and Apple issuer ID

Section titled “Apple key, Apple key ID and Apple issuer ID”

Now, let’s move on to the Apple key.

  1. Go to App Store Connect user and access page

  2. Select the correct team in the dropdown

    1. Click on your name in the top right corner
    2. Click on the team you want to use Apple Developer keys team selection
  3. Click on the Integrations button App Store Connect integrations button

  4. Find the issuer

    Click on the copy button to copy the issuer App Store Connect copy issuer

  5. Click on the plus button App Store Connect add key button

  6. Set the name of the key and set the access to App manager and click on the Generate button App Store Connect add key name, set access to app manager and generate button

  7. Save the key ID

    App Store Connect copy key ID

  8. Download the key

    App Store Connect download key

    App Store Connect download key warning

Congratulations 🎉 You have created the Apple key, Apple key ID and Apple issuer ID.

Now, you are ready to export the certificate. As you remember, one of the first steps of this guide was setting up the distribution certificate.

However, Apple in their infinite wisdom, decided that the way you export the certificate is quite different from the way you create them 🙃 Let’s get into setting it up:

  1. Open Keychain Access

    1. Click Command + Space to open the search bar
    2. Search for Keychain Access
    3. Click on the Keychain Access app
  2. Select the login category and click on the My Certificates button Keychain Access login category

  3. Find your certificate in the list

    The certificate should be named Apple Distribution: [Your Name/Company] (your team ID) Keychain Access find certificate

  4. Right-click on the certificate and select Export Keychain Access export certificate

  5. Save the certificate as a .p12 file

    1. Make sure to select a good name for the certificate file
    2. Make sure the file format is set to Personal Information Exchange (.p12)
    3. Click on the Save button

    Keychain Access save certificate dialog

  6. When asked for the password, you can either:

    • Skip the password (recommended for simplicity): Click OK without entering a password
    • Set a password: If you prefer to protect your certificate with a password, you can set one here. Password-protected .p12 files are fully supported by the Capgo CLI - just provide the password using the --p12-password option when running configuration command.

    Keychain Access save certificate password dialog

  7. When asked for the “login keychain password”, give the password you use to login to your Mac

    Give the password you use to login to your Mac. Then, click on the Allow button.

    Keychain Access save certificate login keychain password

Congratulations 🎉 You have exported the certificate.

Now, you are ready to export the provisioning profile. I promise, this is the last thing you will need to get from Apple.

  1. Go to Apple Developer Profiles

  2. Select the correct team in the dropdown

    1. Click on your name in the top right corner
    2. Click on the team you want to use Apple Developer keys team selection
  3. Make sure you are on the correct page It should look like this, if it doesn’t click on profiles in the sidebar

    Apple Developer profiles page

  4. Click on the + button Apple Developer add profile button

  5. Select the profile type Select App Store Connect and click on the Continue button

    Apple Developer select profile type

  6. Select the app you want to build

    Find your app in the dropdown and click on the Continue button

    Apple Developer select app

  7. Select the correct distribution certificate

    Select the certificate you exported in the previous step and click on the Continue button

    Apple Developer select distribution certificate

    If you are unsure which certificate to select, come back to Keychain Access and find the certificate you exported. Then look at the expiration date.

    Apple Developer select distribution certificate expiration date

  8. Name the profile

    Give the profile a name and click on the Generate button

    Apple Developer name profile

  9. Download the profile

    Click on the Download button to download the profile

    Apple Developer download profile

Congratulations 🎉 You have now got everything you need to configure Capgo Native Build.

You have done it! You have now got everything you need to configure Capgo Native Build.

The command you will need to run is:

Terminal window
npx @capgo/cli@latest build credentials save \
--platform ios \
--apple-team-id UVTJ336J2D \
--apple-key ./capgo-tutorial/AuthKey_66FGQZB566.p8 \
--apple-key-id 66FGQZB566 \
--apple-issuer-id 0cd4db4a-5598-45b8-9d32-75cdf127d005 \
--certificate ./capgo-tutorial/capgo-build-tutorial-certificate.p12 \
--provisioning-profile ./capgo-tutorial/capgo_native_build_tutorial.mobileprovision \
--apple-profile-name capgo_native_build_tutorial

If all went well, you will see the following output:

Capgo CLI credentials save output

Now, you are ready to run your first build.

Run the following command to build your app:

Terminal window
npx @capgo/cli@latest build request --platform ios

Congratulations 🎉 At this point, you have successfully built your app and it is ready to be submitted to the App Store.

If for whatever reason you are having issues either with Capgo Native Build, configuring the credentials or building the app, please don’t hesitate to reach via our support.