0
votes

We have implemented deferred deep linking in our branch using Branch.io. The flow works correctly in our Android build but not in iOS. When clicking on a deep link in an iOS device the app is correctly installed but the deferred content piece of our deep link is not working. The branch validate gem is all green.

The relevant code is:

branch.subscribe(async ({ error, params, uri }) => {
  if (error) {
    console.error(`Error from Branch: ${error}`);
    return;
  }

  if (params['+non_branch_link']) {
    return;
  }

  if (!params['+clicked_branch_link']) {
    return;
  }

  const deepLink = params.$deeplink_path;
  if (deepLink) {
    Linking.openURL(deepLink).catch((e) => { console.log('[Branch Error]', e); });
  }
});
2

2 Answers

1
votes

Never was able to solve this with existing paradigm. Ended up just setting state inside of my if block and redirecting the user on the incorrect screen if the state was set. Must be some kind of race condition.

¯\ (ツ)

1
votes

Did you try to set a initSessionTtl time of about 10 seconds?

componentDidMount() {
    branch.initSessionTtl = 10000;
    branch.subscribe(({ error, params, uri }) => {
        //Handle the deep link here
    });
}