Skip to content

Instantly share code, notes, and snippets.

<script type="text/javascript">
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode banner closeBanner creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode".split(" "), 0);
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="">
// These are the customizations to the banner itself
icon: '',
title: 'Branch Demo App',
description: 'The Branch demo app!',
openAppButtonText: 'Open', // Text to show on button if the user has the app installed
downloadAppButtonText: 'Download', // Text to show on button if the user does not have the app installed
sendLinkText: 'Send Link', // Text to show on desktop button to allow users to text themselves the app
phonePreviewText: '+44 9999-9999', // The default phone placeholder is a US format number, localize the placeholder number with a custom placeholder with this option
^(NSDictionary *params, NSError *error) {
if (!error && [params objectForKey:@"coupon_id") {
// show the view controller to show the coupon clicked on
NSLog(@"params: %@", params.description)
NSMutableDictionary *branchDict = [[NSMutableDictionary alloc] init];
[params setObject:@"1452" forKey:@"referring_user_id"];
[params setObject:@"Alex Austin" forKey:@"referring_user_name"];
[params setObject:@"" forKey:@"referring_user_pic"];
[[Branch getInstance] getShortURLWithParams:branchDict
^(NSDictionary *params, NSError *error) {
if (!error && [params objectForKey:@"station_id") {
// show the view controller that plays a radio station
NSLog(@"params: %@", params.description)
// Initialize the param and feature variable
NSString *feature = @"invite";
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
[params setObject:@"1452" forKey:@"station_id"];
[params setObject:@"" forKey:@"$og_image_url"];
[params setObject:@"Check out my favorite station on iHeartRadio" forKey:@"$og_description"];
[params setObject:@"Wild 94.9" forKey:@"$og_title"];
UIActivityItemProvider *itemProvider = [Branch getBranchActivityItemWithParams:params andFeature:feature];
UIActivityViewController *shareViewController = [[UIActivityViewController alloc] initWithActivityItems:@[itemProvider] applicationActivities:nil];
// Present the share sheet!
[[Branch getInstance] getShortURLWithParams:@{@"object_id": @"1234"} andChannel:@"sms" andFeature:BRANCH_FEATURE_TAG_SHARE andCallback:^(NSString *url, NSError *error) {
if (!error) NSLog(@"got my Branch link to share: %@", url);
Branch *branch = [Branch getInstance];
[branch initSessionWithLaunchOptions:launchOptions andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {
if (!error) {
// params are the deep linked params associated with the link that the user clicked -> was re-directed to this app
// params will be empty if no data found
// ... insert custom logic here ...
NSLog(@"params: %@", params.description)
<html prefix="og:">
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="" />
<meta property="og:url" content="" />
<meta property="og:image" content="" />
<meta property="al:ios:app_store_id" content="342792525" />
<meta property="al:ios:url" content="imdb://title/tt0117500" />