Branch.io - ContinueActivity 未返回正确的 ActivityType [英] Branch.io - ContinueActivity not returning correct ActivityType

查看:18
本文介绍了Branch.io - ContinueActivity 未返回正确的 ActivityType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为我们的 Titanium iOS 应用实施 Branch.io.使用最新的 4.8 Studio 和 Titanium SDK 6.0.

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.

使用了continueactivity"的事件侦听器,但activityType 是:NSUserActivityTypeBrowsingWeb",而不是我在Entitlements.plist 文件中指定的那个.

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

这是我们当前的代码:

    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);
}

这意味着函数branchContinueActivity"没有触发分支函数continueUserActivity".

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

我们当然添加了:

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

进入tiapp.xml

into tiapp.xml

我们在这里做错了什么?

What are we doing wrong here?

推荐答案

来自 Branch.io 的 Alex 在这里:没有看到更多代码,这很难调试.我们在 Titanium SDK 文档 这里,还有一个功能齐全的Titanium可以用作参考的测试平台应用.

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.

如果您仍然遇到困难,最好的选择是通过我们的提交工单集成团队SDK GitHub 存储库上的问题以便我们可以更轻松地进行调试.

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.

这篇关于Branch.io - ContinueActivity 未返回正确的 ActivityType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆