Branch SDK Error

#1

I am getting this Error: [Unhandled promise rejection: Error: BranchUniversalObject for ident A6987200-1271-49C2-A26C-E10B45B5A72B not found.]
while following the Example Documentation here: https://docs.expo.io/versions/latest/sdk/branch.html

My implementation looks like this:

createBranchUniversalObject = async () => {
    const { randomId } = this.props.onboarding
    this._branchUniversalObject = await Branch.createBranchUniversalObject(
      `${randomid}`,
      {
        title: `Leaderboard Share`,
        // contentImageUrl: ``,
        contentDescription: `User invite through Leaderboard`,
        // This metadata can be used to easily navigate back to this screen
        // when implementing deep linking with `Branch.subscribe`.
        metadata: {
          screen: 'MainLeaderboard',
          params: JSON.stringify({ volleyId }),
        },
      }
    )
    console.log(`createBranchUniversalObject branch obect: ${JSON.stringify(this._branchUniversalObject, null, 2)}`)
  }
  onShareLinkPress = async () => {
    console.log(`onShareLinkPress branch obect: ${JSON.stringify(this._branchUniversalObject, null, 2)}`)
    const shareOptions = {
      messageHeader: `Message Header`,
      messageBody: `Message Body`,
    }
    let linkProperties = { feature: 'share', channel: 'RNApp' }
    await this._branchUniversalObject.showShareSheet(shareOptions, linkProperties);
  }

The error is related to ident being associated with a different value in each method. I have tried to set everything inside state and call it but I’m still getting two separate ident results from each time this._branchUniversalObject is referred to.

0 Likes

#2

I don’t see anything in the code you shared. :thinking:
How are you importing Branch? Could you be calling createBranchUniversalObject more than once?

0 Likes

#3
import { Contacts, Permissions, MailComposer, DangerZone } from 'expo';
let { Branch } = DangerZone
componentDidMount() {
    // Branch.subscribe((bundle) => {
    //   if (bundle && bundle.params && !bundle.error) {
    //     // `bundle.params` contains all the info about the link.
    //     console.log(`BRANCH BUNDLE: ${bundle}`)
    //   }
    // })
    this.createBranchUniversalObject()
  }
<Button
    iconLeft
    key={i}
    style={styles.buttonStyle}
    // onPress={() => this.shareContent(item.title)}
    onPress={this.onShareLinkPress}
>

Those are the times that things are referenced

Here is the result:

createBranchUniversalObject branch obect: {
  "ident": "E4CF6754-1EC9-4734-B0B4-F3DCBF573ABA"
}

onShareLinkPress branch obect: {
  "ident": "D28E9676-71FF-47D4-A31F-C8B4C12319BD"
}
0 Likes

#4

Hi, were you able to fix it?

0 Likes

#5

No I tried to test it in a few different ways but nothing seemed to work. Any ideas?

0 Likes

#6

Did you try to test it as a standalone app or using the expo client?

0 Likes

#7

Using the Expo client.

0 Likes

#8

you’ve got to test it as a standlaone app

1 Like

#9

What do you mean by that?

0 Likes

#10

Hmmm I’m facing the same error. By testing it as a standalone app, do you mean to go through the steps specified here https://docs.expo.io/versions/latest/guides/building-standalone-apps.html without submitting it to the app stores?

0 Likes

#11

https://docs.expo.io/versions/latest/guides/building-standalone-apps.html

0 Likes

#12

yes, that is what i mean

0 Likes

closed #13

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

0 Likes