Opening the app with links
URI Schemes¶
While we're still on the dashboard, let's come up with a URI scheme for your app. This can be anything you want (so long as it doesn't contain any "special" characters), and is used for opening your app in situations where Universal Links can't. For example, a URI scheme might look something like this:
super-cool-app://
Once you have a URI scheme to use, got to the link settings page of your dashboard, enter the URI scheme you've devised (in the iOS URI Scheme
box), and click save. Once the dashboard has updated, switch to Xcode, and:
- Click the project file (it's the item at the top of the file list)
- Select the
Info
tab - Expand the
URL Types
section - Click the
+
symbol - In the
URL Schemes
box, paste the URI Scheme you decided on above
Note: Xcode only needs to portion of your URI scheme before the
://
, so only paste in the text part: your scheme won't work if you add the whole scheme.
Universal Links¶
Dashboard setup¶
Universal Links are crucial for opening your app, so getting them set up is one of the most important parts of integrating with Branch.
To configure Universal Links:
- Go to the
Certificates, Identifiers & Profiles
page of Apple's Developer website. - Search for the
Bundle Identifier
that you set for your project
You can find this by going to Xcode, and select the blue project file with your apps name. The Bundle Id will be the second entry on the screen
- Expand the entry, and copy the
Prefix
value.
If you don't see your Bundle Id listed, it may not have registered yet. To give it a kick, and speed things up:
- Open Xcode, and select your project file
- Select the "Capabilities" tab
- Scroll to the bottom and turn "Associated Domains" to "on"
If you go back to the developer website, you should now see your Bundle Id listed
With the Prefix
for your app, head over to the link settings page of your dashboard. Here:
- Set the
Apple App Prefix
to the value you just copied, - Update the
Bundle Identifier
field to the id you set for your project.
Don't forget to click save!
Xcode setup¶
Once you've updated your dashboard settings, you need to switch back to Xcode to configure the Entitlements
with your Branch app. Before switch, though, make sure to note down the Branch <something>.app.link
domain that your Branch app is using. In Xcode:
- Click your project file (top of the list)
- Select the
Capabilities
tab - Expand the
Associated Domains
section
Set the Associated Domains
to on
, and add two entries:
applinks:something.app.link
applinks:something-alternate.app.link
replacing something
with your Branch domain.
One last thing to note is that iOS doesn't update your app's Universal Link settings automatically, so before moving on, make sure to uninstall the app from your device, and re-install it with the new changes.
Testing break¶
At this point, your Branch links should now be able to open your app. Give it a shot by creating a new link, and clicking it from the native iMessage app. You should see your app immediately launched to its home screen.
Troubleshooting¶
Did your link not open your app? As cliché as it sounds, try uninstalling the app and then turning your phone off and on again. If you continue to run into issues, double-check all of the values you added in the above steps to verify that they are correct. Still no luck? Then it is time to reach reach out for help.