ContinueActivity未返回正确的ActivityTy

ContinueActivity未返回正确的ActivityTy

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

问题描述

我目前正在将Titan.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.

到目前为止,一切工作都可以与集成正常进行,只是当我尝试打开应用程序时,当它冷死"时,我们无法从创建的Activity中获得正确的activityType.

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

我们在做什么错了?

推荐答案

此处来自Branch.io的Alex:在看不到您的更多代码的情况下,很难调试.我们在Titanium SDK文档中提供了针对这种情况的解决方案 ,还有一个功能齐全的钛测试平台应用,您可以将其用作参考.

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 20:49