Filters

Validation Tools

Branch CLI for Automated iOS Integration

Overview

The Branch CLI is a simple plugin which integrates Branch into your iOS project for you.

Other Important Features

  • Validates Universal Links: The CLI ensures that your app supports Universal Links by comparing your project’s bundle identifier, team id, and domain entries in your entitlements file against what is stored in Branch’s Apple App Site Association file for your link domain.
  • Supports multiple targets: To install for a specific target, use the --target flag, or use the configuration editor to change the inferred target each time. If the target in question is an extension, the tool will add the SDK, set the keys into the Info.plist, and patch source (if it's a Messages extension, for example).
  • Includes Rake for Task Management: This gem has a rake for Task Management that is available here.
  • Fastlane Plugin: There is also a Fastlane plugin available here, should you prefer to use it instead.

Prerequisites

  1. Ensure that you’ve set up your Branch Dashboard using the instructions here, and have your Branch Key and Branch link domain handy.
  2. An iOS project with which you’d like to integrate Branch.

Installation

  1. From terminal, cd into your iOS app’s project directory (the one that includes the xcodeproj file).
  2. Type gem install branch_io_cli into terminal.

📘

Note

If you get an error saying that you don’t have permissions to perform this operation, try installing with sudo.

Example: Using the CLI on a project with no third party SDKs

  1. Type br setup into terminal, and you’ll be greeted with a few options on the following screen:

  1. Fill out your Branch Key from Account Settings, and your app’s link domain information from your Link Settings pages.

📘

Note

You don’t need to add your -alternate.app.link domain. The CLI will take care of that for you.

  1. Once complete, you’ll see the following set of instructions:

  1. If your app does not have any third party SDKs integrated, pick option 2: Set this project up to use CocoaPods and add the Branch SDK.
  2. Before modifying your project, the CLI will confirm your inputs. If something is entered incorrectly, you’ll have the option to return and change your values:

  1. To make changes to your URI scheme for example, enter N to the prompt.
  2. To insert your app’s URI scheme, enter 4 into the prompt:

  1. After entering a URI scheme, enter option 19: Accept and Continue, which starts the Universal Link validation process:

  1. If your link domains, are found in your app's apple-app-site-association file, the rest of the process will continue as expected.

  1. After installing cocoapods, the CLI will install the Branch plugin and inject values and various snippets from your app into your project.

You're all done!

AASA Validator

In case you need to validate your domain, use the AASA Validator to check universal linking is set up properly.