BranchMetrics / unity-branch-deep-linking-attribution

The Branch Unity SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/apps/unity/
MIT License
118 stars 25 forks source link

Callback of method Branch.shareLink doesn't work well #128

Closed matteuo closed 5 years ago

matteuo commented 6 years ago

Hi,

I have a problem with branch for unity, specifically with the callback of the method Branch.shareLink(..).

Practically randomly the callback returned by the Branch.shareLink method () does not work, and sometimes returns null parameters. sometimes it works sometimes no, why?

When it works: I saw that the callback usually occurs two times, the first time both error and parameter are null, the second time parameter is present.

When it does not work: Sometimes, callback is one and in that case both error and parameter are null.


I'm using the version of unity 5.6.5p3, unfortunately i can not update to the most recent one.

I downloaded BranchUnityWrapper on April 24th 2018. How can I see the sdk version of branch?


I have the same problem with your test application and i would like to solve the problem quickly. I also tried to add a new method to the branch.cs script in the hope of solving, but it did not help.

public static void resetCallbacks () {
    _branchCallbacks = new Dictionary<string, object>();
    _nextCallbackId = 0;
    _sessionCounter = 0;
}

Here the code of my universalobject and the linkproperty.

`public void DoShareLink () { try { if (universalObject == null) { universalObject = new BranchUniversalObject(); universalObject.canonicalIdentifier = User.id.ToString(); universalObject.canonicalUrl = "https://branch.io"; universalObject.title = "id12345 title"; universalObject.contentDescription = "My awesome piece of content!"; universalObject.imageUrl="https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"; universalObject.contentIndexMode = 0; // register a view to add to the index //Branch.registerView(universalObject); }

     if (linkProperties == null) {
        linkProperties = new BranchLinkProperties();
        linkProperties.tags.Add("tag1");
        linkProperties.tags.Add("tag2");
        linkProperties.feature = "invite";
        linkProperties.channel = "Twitter";
        linkProperties.stage = "2";
        linkProperties.controlParams.Add("$desktop_url", "http://example.com");
     }

     Branch.shareLink(universalObject, linkProperties, "hello there with short url", (parameters, error) => {
        if (error != null) {
            Debug.LogError("Branch.shareLink failed: " + error);
            //Branch.resetCallbacks();
        } else if (parameters != null) {
            string shareLink = parameters["sharedLink"].ToString();
            CallShareLink(shareLink);
            //Branch.resetCallbacks();
        }
     });

 } catch(Exception e) {
     Debug.Log(e);
 }

}`

csalmi-branch commented 5 years ago

@matteuo Are you still experiencing this issue, or did you find a resolution?