附加到现有链接时缺少Branch.io参数 [英] Branch.io parameters missing when appended to an existing link

查看:116
本文介绍了附加到现有链接时缺少Branch.io参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用户单击
https://a.test-app.link/identifier?foo=bar
,然后将其重定向到AppStore以下载该应用程序。然后,应用程序应该能够在启动过程中获取 foo 参数。



要调试此程序,请按照以下步骤操作:


  1. 在以下位置创建链接测试环境。

  2. 点击设备上的链接。

  3. 使用Xcode安装应用。

  4. 启动应用程序并在启动过程中使用

      let branch = Branch.getTestInstance()
    分支读取参数。 setDebug()
    branch.initSessionWithLaunchOptions(launchOptions,andRegisterDeepLinkHandler:{参数,如果错误== nil {
    //
    //参数是与用户单击的链接关联的深层链接参数->已重定向到此应用程序
    //如果未找到数据,则params将为空
    print(params)
    }
    })


我还在info.plist文件中设置了正确的API令牌。 / p>

据我了解,我现在应该在参数中获取我的 foo 参数字典,但是这没有发生。使参数起作用的唯一方法是使用仪表板添加静态参数。此外,我什至在已经从仪表板中删除的 params 字典中找到了旧参数,但没有URL查询参数的迹象。



有人知道我在做什么吗?



谢谢

解决方案

我们有一个更新和一个可能的原因,结果比预期的要有趣得多!



TL; DR:将链接数据作为查询字符串参数传递给 app.link test-app.link 。这些症状背后的真正原因是其他原因,但是普通用户永远不会遇到。



症状



将链接参数附加到现有分支分支中的 (例如: https:/ /bnpo.app.link/identifier?foo=bar )不能可靠地显示在应用程序内部。



原因



事实证明,在某些时候,Apple改变了移动Safari的行为,因此当您输入历史记录中的URL 时,Safari实际上会在您加载网页时类型。对于分支机构服务器,这与常规访问完全相同,因此我们为每个访问创建设备指纹。您实际上可以通过转到分支上的链接点击页来实际查看此操作仪表板,在Safari地址栏中输入您之前访问过的分支的URL ,然后查看所有点击链接。



问题是Branch SDK从最早到最新依次消耗设备指纹。如果您先前在测试时曾访问过 https://bnpo.app.link/identifier ,然后使用附加的查询参数( https://bnpo.app.link/identifier?foo=bar ),Safari已加载 https://bnpo.app.link/identifier ,甚至没有机会键入?foo = bar



这意味着您的设备现在有两个不同的未完成指纹:


  1. 一个用于 https://bnpo.app.link/identifier

  2. 另一个用于 https://bnpo.app.link/identifier?foo=bar

即使您按 Go 来触发URL为 https://的应用程序的启动bnpo.app.link/identifier?foo=bar https://bnpo.app.link/identifier 的指纹已经存在,并且会先在应用程序中使用,因为它较旧(取决于您键入的速度是一两秒)。



如果然后退出应用程序并立即再次启动它,您将获得带有额外参数的下一个指纹。



解决方案



这种情况在测试过程中很容易出现,但是现实生活中的用户几乎永远不会遇到。仅当手动键入已访问的URL,然后向其附加其他查询参数时,才会发生这种情况。



出于测试目的,只需反复重新启动应用程序,直到您在启动过程中从分支 init()调用中获取任何数据( + clicked_branch_link:0 )(以耗尽所有未清余额)


  1. 使用Notes输入完整的URL并将其粘贴到Safari

  2. 只需从Notes内打开URL

我们将在文档中添加以上内容的警告性注释。感谢您引起我们的注意!


I am trying to make it so a user clicks a Branch.io link in the form https://a.test-app.link/identifier?foo=bar and then be redirected to the AppStore to download the app. The app should then be able to grab the foo parameter during launch.

To debug this I have followed this procedure:

  1. Create the link under the test environment.
  2. Tap the link on the device.
  3. Install app with Xcode.
  4. Launch the app and read the parameters during launch with

    let branch = Branch.getTestInstance()
    branch.setDebug()
    branch.initSessionWithLaunchOptions(launchOptions, andRegisterDeepLinkHandler: { params, error in
        if error == nil {
            // params are the deep linked params associated with the link that the user clicked -> was re-directed to this app
            // params will be empty if no data found
            print(params)
        }
    })
    

I have also set the correct API tokens in the info.plist file.

From what I understand, I should be getting by now my foo parameter within the params dictionary, but this is not happening. The only way to get parameters to work is by adding static ones using the dashboard. Furthermore, I'm even getting old parameters in the params dictionary that I have already removed from the dashboard, but no sign of the URL query parameters.

Does anyone have an idea of what I'm doing wrong?

Thanks

解决方案

We have an update and a probable cause, and this ended up being much more interesting than expected!

TL;DR: passing link data as a query string parameters works for both app.link and test-app.link. The real cause behind these symptoms is something else, but would never be encountered by a normal user.

Symptoms

Link parameters appended to an existing Branch link (for example: https://bnpo.app.link/identifier?foo=bar) do not reliably show up inside the app.

Cause

It turns out that at some point, Apple changed the behavior of mobile Safari so that when you enter a URL that is also in your history, Safari actually preloads the page as you type. To the Branch servers, this looks exactly the same a regular visit, so we create device fingerprints for each one of these 'visits'. You can actually see this in action by going to the Link Clicks page on your Branch dashboard, entering the URL for a Branch that you have visited before into the Safari address bar, and then watching all the link 'clicks' roll in.

The problem is the Branch SDK consumes device fingerprints sequentially from oldest to newest. If you have previously visited https://bnpo.app.link/identifier while testing, and then re-enter that URL with an appended query parameter (https://bnpo.app.link/identifier?foo=bar), Safari has already loaded https://bnpo.app.link/identifier before you even have a chance to type in ?foo=bar.

This means your device now has two different fingerprints outstanding:

  1. One for https://bnpo.app.link/identifier
  2. Another for https://bnpo.app.link/identifier?foo=bar

Even though you press Go to trigger the launch of the app with the URL https://bnpo.app.link/identifier?foo=bar, the fingerprint for https://bnpo.app.link/identifier already exists, and is consumed first within the app because it is a older (by a second or two, depending on how fast you type).

If you then exit the app and launch it again immediately, you'll get the next fingerprint with the extra parameter.

Solution

This is a situation that would come up fairly easily during testing, but that real-life users are almost never going to encounter. It only occurs when manually typing in a URL that has already been visited, and then appending additional query parameters to it.

For testing purposes, simply relaunch your app repeatedly until you get no data (+clicked_branch_link: 0) from the Branch init() call during launch (to use up any outstanding fingerprints), and then either...

  1. Type out your URL in full using Notes and paste it into Safari
  2. Just open the URL from inside Notes

We'll add a cautionary note summarizing the above in our documentation. Thanks for bringing it to our attention!

这篇关于附加到现有链接时缺少Branch.io参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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