Skip to content

iOS

Integrate Branch

Inconsistent Universal links behavior on iOS 11.2+

After updating a device to iOS 11.2+, we found that the app's AASA file is no longer downloaded reliably onto your user’s device after an app install. As a result, clicking on Universal Links will no longer open the app consistently. You can set forced uri redirect mode on your Branch links to open the app with URI schemes. View details of the issue on the Apple Bug report.

  • Configure Branch

  • Configure bundle identifier

  • Configure associated domains

    • Add your link domains from your Branch Dashboard
    • -alternate is needed for Universal Linking with the Web SDK inside your Website
    • test- is needed if you need use a test key
    • If you use a custom link domain, you will need to include your old link domain, your -alternate link domain, and your new link domain

      image

  • Configure entitlements

    • Confirm entitlements are within target

      image

  • Configure Info.plist

    • Add Branch Dashboard values

      • Add branch_app_domain with your live key domain
      • Add branch_key with your current Branch key
      • Add your URI scheme as URL Types -> Item 0 -> URL Schemes

      image

  • Confirm app prefix

  • Install Branch

    • Option 1: CocoaPods

      platform :ios, '8.0'
      
      target 'APP_NAME' do
        # if swift
        use_frameworks!
      
        pod 'Branch'
      end
      
      pod install && pod update
      
    • Option 2: Carthage

      github "BranchMetrics/ios-branch-deep-linking"
      
    • Option 3: Manually install the source code with dependencies

      • Drag and drop Branch.framework into Embedded Binaries (select Copy items if needed)
      • Import AdSupport, SafariServices, MobileCoreServices, CoreSpotlight, and iAd into Linked Frameworks

      image

  • Initialize Branch

    • Swift 3

      import UIKit
      import Branch
      
      @UIApplicationMain
      class AppDelegate: UIResponder, UIApplicationDelegate {
      
      var window: UIWindow?
      
      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // if you are using the TEST key
        Branch.setUseTestBranchKey(true)
        // listener for Branch Deep Link data
        Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
          // do stuff with deep link data (nav to page, display content, etc)
          print(params as? [String: AnyObject] ?? {})
        }
        return true
      }
      
      func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
        Branch.getInstance().application(app, open: url, options: options)
        return true
      }
      
      func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
        // handler for Universal Links
        Branch.getInstance().continue(userActivity)
        return true
      }
      
      func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        // handler for Push Notifications
        Branch.getInstance().handlePushNotification(userInfo)
      }
      
    • Objective-C

      #import "AppDelegate.h"
      #import "Branch/Branch.h"
      
      @interface AppDelegate ()
      
      @end
      
      @implementation AppDelegate
      
      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // if you are using the TEST key
        [Branch setUseTestBranchKey:YES];
        // listener for Branch Deep Link data
        [[Branch getInstance] initSessionWithLaunchOptions:launchOptions andRegisterDeepLinkHandler:^(NSDictionary * _Nonnull params, NSError * _Nullable error) {
          // do stuff with deep link data (nav to page, display content, etc)
          NSLog(@"%@", params);
        }];
        return YES;
      }
      
      - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
        [[Branch getInstance] application:app openURL:url options:options];
        return YES;
      }
      
      - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
        // handler for Universal Links
        [[Branch getInstance] continueUserActivity:userActivity];
        return YES;
      }
      
      - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
        // handler for Push Notifications
        [[Branch getInstance] handlePushNotification:userInfo];
      }
      
      @end
      
    • Create a deep link from the Branch Dashboard
    • Delete your app from the device
    • Compile and test on a device
    • Paste deep link in Apple Notes
    • Long press on the deep link (not 3D Touch)
    • Click Open in "APP_NAME" to open your app (example)

    Testing deferred deep linking

    Deferred deep linking is simply deep linking into an app that is not yet installed. Once the app is installed, the context is preserved and the user's first app-open will have the deep link data from the original Branch link. To test this, uninstall the app from your device, click the Branch link, and manually launch the app from Xcode. You should be routed to the correct content within your app.

Implement features

  • Create content reference

    • The Branch Universal Object encapsulates the thing you want to share

    • Uses Universal Object properties

    • Swift 3

      let buo = BranchUniversalObject.init(canonicalIdentifier: "content/12345")
      buo.title = "My Content Title"
      buo.contentDescription = "My Content Description"
      buo.imageUrl = "https://lorempixel.com/400/400"
      buo.publiclyIndex = true
      buo.locallyIndex = true
      buo.contentMetadata.customMetadata["key1"] = "value1"
      
    • Objective-C

      BranchUniversalObject *buo = [[BranchUniversalObject alloc] initWithCanonicalIdentifier:@"content/12345"];
      buo.title = @"My Content Title";
      buo.contentDescription = @"My Content Description";
      buo.imageUrl = @"https://lorempixel.com/400/400";
      buo.publiclyIndex = YES;
      buo.locallyIndex = YES;
      buo.contentMetadata.customMetadata[@"key1"] = @"value1";
      
    • Generates the analytical properties for the deep link

    • Used for Create deep link and Share deep link

    • Uses Configure link data and custom data

    • Swift 3

      let lp: BranchLinkProperties = BranchLinkProperties()
      lp.channel = "facebook"
      lp.feature = "sharing"
      lp.campaign = "content 123 launch"
      lp.stage = "new user"
      lp.tags = ["one", "two", "three"]
      
      lp.addControlParam("$desktop_url", withValue: "http://example.com/desktop")
      lp.addControlParam("$ios_url", withValue: "http://example.com/ios")
      lp.addControlParam("$ipad_url", withValue: "http://example.com/ios")
      lp.addControlParam("$android_url", withValue: "http://example.com/android")
      lp.addControlParam("$match_duration", withValue: "2000")
      
      lp.addControlParam("custom_data", withValue: "yes")
      lp.addControlParam("look_at", withValue: "this")
      lp.addControlParam("nav_to", withValue: "over here")
      lp.addControlParam("random", withValue: UUID.init().uuidString)
      
    • Objective-C

      BranchLinkProperties *lp = [[BranchLinkProperties alloc] init];
      lp.feature = @"facebook";
      lp.channel = @"sharing";
      lp.campaign = @"content 123 launch";
      lp.stage = @"new user";
      lp.tags = @[@"one", @"two", @"three"];
      
      [lp addControlParam:@"$desktop_url" withValue: @"http://example.com/desktop"];
      [lp addControlParam:@"$ios_url" withValue: @"http://example.com/ios"];
      [lp addControlParam:@"$ipad_url" withValue: @"http://example.com/ios"];
      [lp addControlParam:@"$android_url" withValue: @"http://example.com/android"];
      [lp addControlParam:@"$match_duration" withValue: @"2000"];
      
      [lp addControlParam:@"custom_data" withValue: @"yes"];
      [lp addControlParam:@"look_at" withValue: @"this"];
      [lp addControlParam:@"nav_to" withValue: @"over here"];
      [lp addControlParam:@"random" withValue: [[NSUUID UUID] UUIDString]];
      
    • Generates a deep link within your app

    • Needs a Create content reference

    • Needs a Create link reference

    • Validate with the Branch Dashboard

    • Swift 3

      buo.getShortUrl(with: lp) { (url, error) in
        print(url ?? "")
      }
      
    • Objective-C

      [buo getShortUrlWithLinkProperties:lp andCallback:^(NSString* url, NSError* error) {
          if (!error) {
              NSLog(@"@", url);
          }
      }];
      
    • Will generate a Branch deep link and tag it with the channel the user selects

    • Needs a Create content reference

    • Needs a Create link reference

    • Uses Deep Link Properties

    • Swift 3

      let message = "Check out this link"
      buo.showShareSheet(with: lp, andShareText: message, from: self) { (activityType, completed) in
        print(activityType ?? "")
      }
      
    • Objective C

      [buo showShareSheetWithLinkProperties:lp andShareText:@"Super amazing thing I want to share!" fromViewController:self completion:^(NSString* activityType, BOOL completed) {
          NSLog(@"finished presenting");
      }];
      
    • Retrieve Branch data from a deep link

    • Best practice to receive data from the listener (to prevent a race condition)

    • Returns deep link properties

    • Swift 3

      // listener (within AppDelegate didFinishLaunchingWithOptions)
      Branch.getInstance().initSession(launchOptions: launchOptions) { params, error in
        print(params as? [String: AnyObject] ?? {})
      }
      
      // latest
      let sessionParams = Branch.getInstance().getLatestReferringParams()
      
      // first
      let installParams = Branch.getInstance().getFirstReferringParams()
      
    • Objective C

      [[Branch getInstance] initSessionWithLaunchOptions:launchOptions
                              andRegisterDeepLinkHandler:^(NSDictionary * _Nullable params,
                                                           NSError * _Nullable error) {
          if (!error) {
              //Referring params
              NSLog(@"Referring link params %@",params);
          }
      }];
      
      // latest
      NSDictionary *sessionParams = [[Branch getInstance] getLatestReferringParams];
      
      // first
      NSDictionary *installParams =  [[Branch getInstance] getFirstReferringParams];
      
    • Handled within Branch.initSession()

    • Swift 3

      // within AppDelegate application.didFinishLaunchingWithOptions
      Branch.getInstance().initSession(launchOptions: launchOptions) { params , error in
        // Option 1: read deep link data
        guard let data = params as? [String: AnyObject] else { return }
      
        // Option 2: save deep link data to global model
        SomeCustomClass.sharedInstance.branchData = data
      
        // Option 3: display data
        let alert = UIAlertController(title: "Deep link data", message: "\(data)", preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "Okay", style: .default, handler: nil))
        self.window?.rootViewController?.present(alert, animated: true, completion: nil)
      
        // Option 4: navigate to view controller
        guard let options = data["nav_to"] as? String else { return }
        switch options {
            case "landing_page": self.window?.rootViewController?.present( SecondViewController(), animated: true, completion: nil)
            case "tutorial": self.window?.rootViewController?.present( SecondViewController(), animated: true, completion: nil)
            case "content": self.window?.rootViewController?.present( SecondViewController(), animated: true, completion: nil)
            default: break
        }
      }
      
    • Objective C

      // within AppDelegate application.didFinishLaunchingWithOptions
      [[Branch getInstance] initSessionWithLaunchOptions:launchOptions andRegisterDeepLinkHandler:^(NSDictionary * _Nonnull params, NSError * _Nullable error) {
        // Option 1: read deep link data
        NSLog(@"%@", params);
      
        // Option 2: save deep link data to global model
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        [defaults setObject:params.description forKey:@"BranchData"];
        [defaults synchronize];
      
        // Option 3: display data
        UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Title" message:params.description preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *button = [UIAlertAction actionWithTitle:@"Deep Link Data" style:UIAlertActionStyleDefault handler:nil];
        [alert addAction:button];
        [self.window.rootViewController presentViewController:alert animated:YES completion:nil];
      
        // Option 4: navigate to view controller
        if ([params objectForKey:@"navHere"]) {
          ViewController *anotherViewController = [[ViewController alloc] initWithNibName:@"anotherViewController" bundle:nil];
          [self.window.rootViewController presentViewController:anotherViewController animated:YES completion:nil];
        }
      }];
      
  • Display

    • List content on iOS Spotlight

    • Needs a Create content reference

    • Swift 3

      buo.automaticallyListOnSpotlight = true
      
    • Objective-C

      buo.automaticallyListOnSpotlight = YES;
      
  • Track content

    • Track how many times a piece of content is viewed

    • Needs a Create content reference

    • Validate with the Branch Dashboard

    • Swift 3

      BranchEvent.standardEvent(.viewItem, withContentItem: buo).logEvent()
      
    • Objective-C

      [[BranchEvent standardEvent:BranchStandardEventViewItem withContentItem:buo] logEvent];
      
  • Track users

    • Sets the identity of a user (email, ID, UUID, etc) for events, deep links, and referrals

    • Validate with the Branch Dashboard

    • Swift 3

      // login
      Branch.getInstance().setIdentity("your_user_id")
      
      // logout
      Branch.getInstance().logout()
      
    • Objective-C

      // login
      [[Branch getInstance] setIdentity:@"your_user_id"];
      
      // logout
      [[Branch getInstance] logout];
      
  • Track events

    • All events related to a customer purchasing are bucketed into a "Commerce" class of data items

    • All events related to users interacting with your in-app content are bucketed to a "Content" class of data items.

    • All events related to users progressing in your app are bucketed to a "Lifecycle" class of data items.

    • To track custom events - not found in the table below - please see Track Custom Events

    • Validate with the Branch Dashboard

Use the table below to quickly find the event you want to track.

Event Name Event Category iOS Android API
Add To Cart Commerce Event BranchStandardEventAddToCart BRANCH_STANDARD_EVENT.ADD_TO_CART ADD_TO_CART
Add To Wishlist Commerce Event BranchStandardEventAddToWishlist BRANCH_STANDARD_EVENT.ADD_TO_WISHLIST ADD_TO_WISHLIST
View Cart Commerce Event BranchStandardEventViewCart BRANCH_STANDARD_EVENT.VIEW_CART VIEW_CART
Initiate Purchase Commerce Event BranchStandardEventInitiatePurchase BRANCH_STANDARD_EVENT.INITIATE_PURCHASE INITIATE_PURCHASE
Add Payment Info Commerce Event BranchStandardEventAddPaymentInfo BRANCH_STANDARD_EVENT.ADD_PAYMENT_INFO ADD_PAYMENT_INFO
Purchase Commerce Event BranchStandardEventPurchase BRANCH_STANDARD_EVENT.PURCHASE PURCHASE
Spend Credits Commerce Event BranchStandardEventSpendCredits BRANCH_STANDARD_EVENT.SPEND_CREDITS SPEND_CREDITS
Search Content Event BranchStandardEventSearch BRANCH_STANDARD_EVENT.SEARCH SEARCH
View Item Content Event BranchStandardEventViewItem BRANCH_STANDARD_EVENT.VIEW_ITEM VIEW_ITEM
View Items Content Event BranchStandardEventViewItems BRANCH_STANDARD_EVENT.VIEW_ITEMS VIEW_ITEMS
Rate Content Event BranchStandardEventRate BRANCH_STANDARD_EVENT.RATE RATE
Share Content Event BranchStandardEventShare BRANCH_STANDARD_EVENT.SHARE SHARE
Complete Registration Lifecycle Event BranchStandardEventCompleteRegistration BRANCH_STANDARD_EVENT.COMPLETE_REGISTRATION COMPLETE_REGISTRATION
Complete Tutorial Lifecycle Event BranchStandardEventCompleteTutorial BRANCH_STANDARD_EVENT.COMPLETE_TUTORIAL COMPLETE_TUTORIAL
Achieve Level Lifecycle Event BranchStandardEventAchieveLevel BRANCH_STANDARD_EVENT.ACHIEVE_LEVEL ACHIEVE_LEVEL
Unlock Achievement Lifecycle Event BranchStandardEventUnlockAchievement BRANCH_STANDARD_EVENT.UNLOCK_ACHIEVEMENT UNLOCK_ACHIEVEMENT
  • Handle referrals

    • Referral points are obtained from referral rules on the Branch Dashboard

    • Validate on the Branch Dashboard

    • Reward credits

    • Redeem credits

      • Swift 3

        // option 1 (default bucket)
        let amount = 5
        Branch.getInstance().redeemRewards(amount)
        
        // option 2
        let bucket = "signup"
        Branch.getInstance().redeemRewards(amount, forBucket: bucket)
        
      • Objective C

        // option 1 (default bucket)
        NSInteger amount = 5;
        [[Branch getInstance] redeemRewards:amount];
        
        // option 2
        NSString *bucket = @"signup";
        [[Branch getInstance] redeemRewards:amount forBucket:bucket];
        
    • Load credits

      • Swift 3

        Branch.getInstance().loadRewards { (changed, error) in
          // option 1 (defualt bucket)
          let credits = Branch.getInstance().getCredits()
        
          // option 2
          let bucket = "signup"
          let credits = Branch.getInstance().getCreditsForBucket(bucket)
        }
        
      • Objective C

        [[Branch getInstance] loadRewardsWithCallback:^(BOOL changed, NSError * _Nullable error) {
            if (changed) {
            // option 1 (defualt bucket)
            NSInteger credits = [[Branch getInstance] getCredits];
        
            // option 2
            NSString *bucket = @"signup";
            NSInteger credit = [[Branch getInstance] getCreditsForBucket:bucket];
            }
        }];
        
    • Load history

      • Swift 3

        Branch.getInstance().getCreditHistory { (creditHistory, error) in
           print(creditHistory ?? {})
         }
        
      • Objective C

        [[Branch getInstance] getCreditHistoryWithCallback:^(NSArray * _Nullable creditHistory, NSError * _Nullable error) {
            NSLog(@"%@",creditHistory);
        }];
        
  • Handle push notifications

    • Allows you to track Branch deep links in your push notifications

    • Include the Branch push notification handler in Initialize Branch

    • Add a Branch deep link in your push notification payload

      {
        "aps": {
          "alert": "Push notification with a Branch deep link",
          "badge": "1"
        },
        "branch": "https://example.app.link/u3fzDwyyjF"
      }
      
      • Replace https://example.app.link/u3fzDwyyjF with your deep link
    • Read deep link data from initSession Initialize Branch

    • Allows you to deep link into your own from your app itself

    • Swift 3

      Branch.getInstance().handleDeepLink(withNewSession: URL(string: "https://example.app.link/u3fzDwyyjF"))
      
    • Objective C

      [[Branch getInstance] handleDeepLinkWithNewSession:[NSURL URLWithString:@"https://example.app.link/u3fzDwyyjF"]];
      

Warning

Handling a new deep link in your app will clear the current session data and a new referred "open" will be attributed.

  • Track Apple Search Ads

    • Allows Branch to track Apple Search Ads deep linking analytics

    • Analytics from Apple's API have been slow which will make our analytics lower. Additionally, Apple's API does not send us all the data of an ad every time which will make ads tracked by us to show a generic campaign sometimes.

    • Add before initSession Initialize Branch

      • Swift 3

        Branch.getInstance().delayInitToCheckForSearchAds()
        
      • Objective C

        [[Branch getInstance] delayInitToCheckForSearchAds];
        
    • Test with fake campaign params (do not test in production)

      • Swift 3

        Branch.getInstance().setAppleSearchAdsDebugMode()
        
      • Objective C

        [[Branch getInstance] setAppleSearchAdsDebugMode];
        
  • Enable 100% matching

    • Use the SFSafariViewController to increase the attribution matching success

    • The 100% match is a bit of a misnomer, as it is only 100% match from when a user clicks from the Safari browser. According to our analysis, clicking through Safari happens about 50-75% of the time depending on the use case. For example, clicking from Facebook, Gmail or Chrome won’t trigger a 100% match here. However, it’s still beneficial to the matching accuracy, so we recommend employing it.

    • When using a custom domain, add a branch_app_domain string key in your Info.plist with your custom domain to enable 100% matching.

    • By default, cookie-based matching is enabled on iOS 9 and 10 if the SafariServices.framework is included in an app's dependencies, and the app uses an app.link subdomain or sets the branch_app_domain in the Info.plist. It can be disabled with a call to the SDK.

    • Add before initSession Initialize Branch

    • Swift 3

      Branch.getInstance().disableCookieBasedMatching()
      
    • Objective C

      [[Branch getInstance] disableCookieBasedMatching];
      
  • Enable / Disable User Tracking

    If you need to comply with a user's request to not be tracked for GDPR purposes, or otherwise determine that a user should not be tracked, utilize this field to prevent Branch from sending network requests. This setting can also be enabled across all users for a particular link, or across your Branch links.

    • Swift

      Branch.setTrackingDisabled(true)
      
    • Objective C

      [Branch setTrackingDisabled:YES];
      

    You can choose to call this throughout the lifecycle of the app. Once called, network requests will not be sent from the SDKs. Link generation will continue to work, but will not contain identifying information about the user. In addition, deep linking will continue to work, but will not track analytics for the user.

Troubleshoot issues

  • Test your Branch Integration

    Test your Branch Integration by calling validateSDKIntegration in your AppDelegate. Check your Xcode logs to make sure all the SDK Integration tests pass. Make sure to comment out or remove validateSDKIntegration in your production build.

    • Swift

      Branch.getInstance().validateSDKIntegration()
      
    • Objective C

      [[Branch getInstance] validateSDKIntegration];
      
  • To validate if AASA file successfully downloaded

    • Connect a test device to your MAC

    • Uninstall the app

    • View the device's console output in the MAC console

    • Install your app and let it launch

    • Filter the console output by "swcd"

    • If the AASA downloaded sucessfully, you'll see something like the screenshot below (If the AASA did not download, you must uninstall the app, restart the device, and then reinstall the app)

    image

  • Submitting to the App Store

    • Need to select app uses IDFA or GAID when publishing your app (for better deep link matching)
  • App not opening

  • App not passing data

  • Simulate an install

    • Delete your app

    • iPhone Device -> Settings -> Privacy -> Advertising -> Reset Advertising Identifier -> Reset Identifier

    • Add Branch.setDebug(true) before initSession (Initialize Branch Features)

    • Click on a deep link to navigate to your $fallback_url because your app is not installed

    • Install your app

    • Open your app

    • Read from params within initSession for +is_first_session = true

    • Happens whenever the app cannot make a connection to the Branch servers

    • The long deep links will still open the app and pass data

  • Sample apps

  • Track content properties

    • Used for Track content

      Key Value
      BNCRegisterViewEvent User viewed the object
      BNCAddToWishlistEvent User added the object to their wishlist
      BNCAddToCartEvent User added object to cart
      BNCPurchaseInitiatedEvent User started to check out
      BNCPurchasedEvent User purchased the item
      BNCShareInitiatedEvent User started to share the object
      BNCShareCompletedEvent User completed a share
  • Enable logging

    • Use the Branch test key instead of the live key

    • Add before initSession Initialize Branch

    • Remove before releasing to production

    • Swift 3

      Branch.getInstance().setDebug()
      
    • Objective C

      [[Branch getInstance] setDebug];
      
    • Make sure OS_ACTIVITY_MODE is not disabled (link)

  • Use test key

    • Use the Branch test key instead of the live key

    • Add before initSession Initialize Branch

    • Update branch_key in your Info.plist to a dictionary (example)

    • The test key of your app must match the test key of your deep link

    • Remove before releasing to production

    • Swift 3

      Branch.setUseTestBranchKey(true)
      
    • Objective C

      [Branch setUseTestBranchKey:YES];
      
  • Re-enable universal linking

    • Apple allows users to disable universal linking on a per app per device level on iOS 9 and iOS 10 (fixed in iOS 11)

    • Use Test deep link to re-enable universal linking on the device

    • Add before initSession Initialize Branch

    • Recommend to Navigate to content instead

    • Swift 3

      Branch.getInstance().registerDeepLinkController(ViewController(), forKey: "my-key", withPresentation: .optionShow)
      
    • Objective C

      [[Branch getInstance] registerDeepLinkController:customViewController forKey:@"my-key"withPresentation:BNCViewControllerOptionShow];
      
  • Append ?bnc_validate=true to any of your app's Branch links and click it on your mobile device (not the Simulator!) to start the test. For instance, to validate a link like: "https://<yourapp\>.app.link/NdJ6nFzRbK" click on: "https://<yourapp\>.app.link/NdJ6nFzRbK?bnc_validate=true"

    • Use for Universal Linking if you want to get the true/false response from Branch.getInstance().continue(userActivity) within continueUserActivity without a Branch network call
    • Use only if you have a custom link domain
    • Add branch_universal_link_domains to your info.plist with an array of your link domain from your Branch Dashboard

      image

  • Share to email options

    • Change the way your deep links behave when shared to email

    • Needs a Share deep link

    • Swift 3

      lp.addControlParam("$email_subject", withValue: "Your Awesome Deal")
      lp.addControlParam("$email_html_header", withValue: "<style>your awesome CSS</style>\nOr Dear Friend,")
      lp.addControlParam("$email_html_footer", withValue: "Thanks!")
      lp.addControlParam("$email_html_link_text", withValue: "Tap here")
      
    • Objective C

      [lp addControlParam:@"$email_subject" withValue:@"This one weird trick."];
      [lp addControlParam:@"$email_html_header" withValue:@"<style>your awesome CSS</style>\nOr Dear Friend,"];
      [lp addControlParam:@"$email_html_footer" withValue:@"Thanks!"];
      [lp addControlParam:@"$email_html_link_text" withValue:@"Tap here"];
      
  • Share message dynamically

    • Change the message you share based on the source the users chooses

    • Needs a Share deep link

    • Swift 3

      // import delegate
      class ViewController: UITableViewController, BranchShareLinkDelegate
      
      func branchShareLinkWillShare(_ shareLink: BranchShareLink) {
        // choose shareSheet.activityType
        shareLink.shareText = "\(shareLink.linkProperties.channel)"
      }
      
    • Objective C

      // import delegate
      @interface ViewController () <BranchShareLinkDelegate>
      
      - (void) branchShareLinkWillShare:(BranchShareLink*)shareLink {
        // choose shareSheet.activityType
        shareLink.shareText = [NSString stringWithFormat:@"@%", shareLink.linkProperties.channel];
      }