ios-branch-deep-linking-attribution: Deferred deep link is empty when install the app

I have a problem with deferred deep links when we tap on a link and the app is not installed. DeepLinkHandler closure returns ["+is_first_session"): 1, "+clicked_branch_link": 0]after I install the app. If I tap on the same link and I’ve already installed the app - It works as expected and returns deep link info.

To test deferred deep linking I do:

  • remove the app from device
  • select link in Notes app
  • it asks to navigate to AppStore, I proceed
  • launch the app from XCode

I’ve tried those things:

  • launch with both test and live keys and domains
  • checked validateSDKIntegration - all is okay
  • tried to add and remove setUseTestBranchKey

My code in AppDelegate didFinishLaunchingWithOptions:

Branch.getInstance()?.initSession(launchOptions: launchOptions,
                                      andRegisterDeepLinkHandler:
      { [weak self] (params, error) in
        print("Branch parameters: \(params)")
        
        if let urlString = params?[BranchConstants.deepLinkKey] as? String,
          let deepLink = AppURLQuery.deepLink(from: urlString) {
          self?.handleDeepLink(AppURLQuery.deepLink(from: url))
        } 
    })

continue userActivity:

Branch.getInstance()?.continue(userActivity)

open url:

Branch.getInstance()?.application(app, open: url, options: options)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

Had a similar issue in latest SDK version and after some debugging I found that calling Branch setIdentity: before the SDK is initialised stops andRegisterDeepLinkHandler: from being called.

The problem is that initUserSessionAndCallCallback: is called with NO so no callback will happen

// SDK-631 Workaround to maintain existing error handling behavior.
// Some methods require init before they are called.  Instead of returning an error, we try to fix the situation by calling init ourselves.
// There is a follow up ticket to improve this.  SDK-633
- (void)initSafetyCheck {
    if (self.initializationStatus == BNCInitStatusUninitialized) {
        BNCLogDebug(@"Branch avoided an error by preemptively initializing.");
        [self initUserSessionAndCallCallback:NO];
    }
}

version: 0.31.3

It is not fixed. Initial callback is not delivered. Same as it was before. I kill the app open again and callback is present.

I did notice that with previous (0.29.3) version (which is working for us) sometimes the andRegisterDeepLinkHandler callback is delivered with delay. This is breaking our flow for new users as we do not know if they were referred by someone. As a result we have a lot of support tickets due to lack of granted points for refereeing.

Same issue here.