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="https://cdn.branch.io/branch-latest.min.js";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);
branch.init('YOUR-BRANCH-KEY');
</script>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://your-website.com/path/to/awesome/content</loc>
</url>
<url>
<loc>https://your-website.com/path/to/awesome/content-2</loc>
</url>
<url>
branch.banner(
// These are the customizations to the banner itself
{
icon: 'http://icons.iconarchive.com/icons/wineass/ios7-redesign/512/Appstore-icon.png',
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:@"http://graph.facebook.com/517267866/picture?type=large" forKey:@"referring_user_pic"];
[[Branch getInstance] getShortURLWithParams:branchDict
andChannel:@"facebook"
^(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:@"https://s3-us-west-1.amazonaws.com/myapp/radiostation.jpg" 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: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
<meta property="al:ios:app_store_id" content="342792525" />
<meta property="al:ios:url" content="imdb://title/tt0117500" />