Mac OS Basic Integration


SDK Stats

GitHub release (latest by date)GitHub release (latest by date)

Open Source Github Repo:

Configure Branch


Install the Framework

Add the Branch.framework as an embedded binary in your app.

You can drag and drop the framework into your app to install it.

In Xcode, click on your project in the Project Navigator, select your app in the Targets area,
select the 'General' tab up top, and scroll down to the 'Embedded Binaries' section. You can drag
the Branch.framework bundle from the Frameworks/macOS project directory into this area.

Configure Info.plist

Add your app scheme to your Info.plist file so macOS knows what schemes your app can handle. This
example shows testbed-mac as the app scheme. Add just the scheme and not the :// part.

Here's a snippet of xml you can copy into your Info.plist. Right click on your Info.plist and open it as source code. You can paste this snippet before the final </dict> tag. Remember to change YOUR-APP-SCHEME-HERE to the app scheme for your app.



First Scheme Defined

Your app's URI scheme must be the first scheme defined (item 0) in the list.

The Branch SDK will use the first URI Scheme from your list that does not start with fb, db, twitterkit-, pin, or com.googleusercontent.apps. These schemes are ignored by Branch since they are commonly used by other app kits for oauth and other uses.

Initialize Branch

Start Branch when your app first starts up. In your app delegate, start Branch in your applicationWillFinishLaunching:

#import <Branch/Branch.h>

// In your app delegate class file add this method to start the Branch SDK:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    // Insert code here to initialize your application

    // Register for Branch URL notifications:
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(branchWillStartSession:) name:BranchWillStartSessionNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(branchDidStartSession:) name:BranchDidStartSessionNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(branchOpenedURLNotification:) name:BranchDidOpenURLWithSessionNotification object:nil];

    // Create a Branch configuration object with your key:
    BranchConfiguration *configuration = [[BranchConfiguration alloc] initWithKey:@"key_live_joQf7gfRz1vebNOoHPFGJhnhFCarsZg0"];

    // Start Branch:
    [[Branch sharedInstance] startWithConfiguration:configuration];

Next, add a notification handler so your app can handle the deep links:

- (void) branchWillStartSession:(NSNotification*)notification {
    NSLog(@"branchWillStartSession: %@",;

    NSString *url = notification.userInfo[BranchURLKey] ?: @"";
    NSLog(@"URL: %@", url);

- (void) branchDidStartSession:(NSNotification*)notification {
    NSLog(@"branchDidStartSession: %@",;

    NSString *url = notification.userInfo[BranchURLKey] ?: @"";
    NSLog(@"URL: %@", url);

    BranchSession *session = notification.userInfo[BranchSessionKey];
    NSString *data = (session && ? : @"";

- (void) branchOpenedURLNotification:(NSNotification*)notification {
    NSLog(@"branchOpenedURLNotification: %@",;

    NSString *url = notification.userInfo[BranchURLKey] ?: @"";
    NSLog(@"URL: %@", url);

    BranchSession *session = notification.userInfo[BranchSessionKey];

    // Do something with the link!
    // In this contrived example we'll load a view controller that plays the song that was in the link:
    SongViewController *viewController = [SongViewController loadController];
    viewController.songTitle = branchSession.linkContent.title;
    [viewController.window makeKeyAndOrderFront:self];
    [viewController playSong];

macOS Catalina and newer supports universal links. Setup is the same as on iOS.

Make sure to pass the universal link to Branch in the AppDelegate:

- (BOOL)application:(NSApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<NSUserActivityRestoring>> * _Nonnull))restorationHandler {
    [[Branch sharedInstance] continueUserActivity:userActivity];
    return YES;

Updated about a month ago

Mac OS Basic Integration

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.