Branch.io - ContinueActivity not returning correct ActivityType

删除回忆录丶 提交于 2019-12-12 04:31:19

问题


Im currently implementing Branch.io to our Titanium iOS-app. Using the latest 4.8 Studio with Titanium SDK 6.0.

Everything works fine with the integration so far, except that when I try to open the app, when it's "cold dead", we're not getting the correct activityType from the created Activity.

The eventlistener of "continueactivity" is used, but the activityType is: "NSUserActivityTypeBrowsingWeb" and not the one I have specified in the Entitlements.plist-file.

Here's our current code:

    var Branch = require("io.branch.sdk");

Branch.addEventListener("bio:initSession", branchInitCallback); // When opened via Branch, when app is "active"
Ti.App.iOS.addEventListener("continueactivity", branchContinueActivity); // If opened via Branch, when "hard closed"

// Create the Activity incase the app is Super-closed
var branchActivity = Ti.App.iOS.createUserActivity(
{
    activityType: 'io.branch.{appname}.universalLink'
});

branchActivity.becomeCurrent();

Branch.initSession();

// Branch Callbacks
function branchInitCallback(_data)
{
    Ti.API.info("inside onInitSessionFinished");

    alert("init: " + JSON.stringify(_data));

    console.log(_data);

    if(_data)
    {
        if(_data["+clicked_branch_link"] != undefined && _data["+clicked_branch_link"] == 1)
        {
            alert("CLICKED BRANCH LINK");
        }
    }
}   

function branchContinueActivity(e)
{
    Ti.API.info("inside continueactivity: " + JSON.stringify(e));

    if (e.activityType === 'io.branch.{appname}.universalLink') 
    {
        Branch.continueUserActivity(e.activityType, e.webpageURL, e.userInfo);
    }   

    alert("continue:" + JSON.stringify(e));

    console.log(e);

    var sessionParams = Branch.getLatestReferringParams();

    alert("session: " + JSON.stringify(sessionParams)); 

    console.log(sessionParams);
}

This means that the function "branchContinueActivity" is not fireing the Branch-function "continueUserActivity".

We've ofcourse added:

<key>NSUserActivityTypes</key>
<array>
  <string>io.branch.{appname}.universalLink</string>
</array>    

into tiapp.xml

What are we doing wrong here?


回答1:


Alex from Branch.io here: without seeing more of your code, this is tough to debug. We cover a solution for this situation on our Titanium SDK docs here, and there is also a fully functional Titanium Testbed app you can use as a reference.

If you're still running into difficulties, the best option is to file a ticket with our Integrations team or an issue on the SDK GitHub repo so we can debug more easily.



来源:https://stackoverflow.com/questions/40610987/branch-io-continueactivity-not-returning-correct-activitytype

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!