Branch CLI for Automated iOS Integration¶
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.
- Ensure that you’ve set up your Branch Dashboard using the instructions here, and have your Branch Key and Branch link domain handy.
- An iOS project with which you’d like to integrate Branch.
- From terminal, cd into your iOS app’s project directory (the one that includes the xcodeproj file).
gem install branch_io_cliinto 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¶
br setupinto terminal, and you’ll be greeted with a few options on the following screen:
Note: You don’t need to add your -alternate.app.link domain. The CLI will take care of that for you.
Once complete, you’ll see the following set of instructions:
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.
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:
To make changes to your URI scheme for example, enter N to the prompt.
To insert your app’s URI scheme, enter 4 into the prompt:
After entering a URI scheme, enter option 19: Accept and Continue, which starts the Universal Link validation process:
If your link domains, are found in your app's apple-app-site-association file, the rest of the process will continue as expected.
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!
In case you need to validate your domain, use the AASA Validator to check universal linking is set up properly.
App Indexing Validator¶
Check your app to see if it can properly index and surface content for Firebase through our App Indexing Validator.