React Native DevOps— iOS

Part One: Code Signing

Jake Myers
Red Squirrel
3 min readOct 12, 2020

--

Non-native mobile ecosystems like Flutter and React Native have evolved at a rapid pace, leaving behind a collection of outdated articles. Rather than writing another prescriptive tutorial, the goal of this series is for you to learn, at a high level, about each part of the mobile deployment process and how one might go about configuring continuous integration for their project.

Photo by Zan on Unsplash

iOS Building Blocks

The process for building iOS apps really hasn’t changed much over the last few years, at least relative to the rapidly changing world of cross-platform technologies like React Native. While things like code-signing and dependency management differ from project to project, the steps to build an iOS app are mostly similar.

Code Signing

From Apple’s documentation on Code Signing:

Code signing your app assures users that it is from a known source and the app hasn’t been modified since it was last signed. Before your app can integrate app services, be installed on a device, or be submitted to the App Store, it must be signed with a certificate issued by Apple.

The easiest way to set this up is to let Xcode handle this for you. This works well if you are working on an app by yourself, but when you are working on a team, it can be difficult to manage.

Sharing code-signing identities between team members is easy to implement, and can speed things up significantly for teams. It’s a little more work to set up than automatic code-signing, but the effort can pay off big, saving time in the long run.

Enter fastlane match.

Fastlane is a set of tools used to build and deploy mobile apps. One of those tools, match, automates the management of provisioning profiles and certificates. There are multiple ways to implement match, depending on your needs, and there is top-tier documentation available for reference.

At Red Squirrel Technologies, we use match with GitHub to share code-signing certs and provisioning profiles between team members and CI services. Getting started with this is straightforward and only takes a few minutes.

Setting up match

Before getting started with match, we’ll need to add fastlane to our project. Installing fastlane is outside of the scope of this article, but the instructions can be found in their wonderful documentation.

  1. We recommend creating a new Apple account with a set of team-centric credentials, like developers@company.com, so nobody has to use their personal credentials for these services.
  2. It’s also a good idea to create a Github or Bitbucket account under your organization for the same purposes. Copy the repo’s URL as you will need it for the next step.
  3. Fire up your favorite console, then inside your ios folder, run fastlane match init to install match in your project. A series of prompts will guide you through the process.
  4. After installing match, the first step is to clean house. We’ll use match to clear existing certs and provisioning profiles from the Apple developer account. From the ios directory, run fastlane match nuke to destroy the existing credentials associated with the app. Keep in mind this is a destructive action, and if you decide not to use match, you’ll have to set up new certs via Xcode. It’s not 100% necessary, but keeping a clean house will eliminate confusion down the road.
  5. With a clean slate, we can use match to create new certs and provisioning profiles. Run fastlane match development, then sit back and watch as match saves the profiles to your machine, adds the certs and private keys to your keychain, then pushes it all to your remote Git repo all in one fell swoop. Easy livin’.

The only thing left to do is select the new provisioning profile in the Signing & Capabilities tab in Xcode. For more advanced options, or if you get stuck, check out the match documentation.

So we’ve learned a bit about code-signing in iOS, and how to make things easier with automation, In the next installment, we’ll dig into how iOS apps are built using Xcode, and how we can easily automate that using similar tools.

Other articles in this series:

--

--