Branch deep links works very differently in different apps and phones

谁说我不能喝 提交于 2019-12-10 12:03:52

问题


I am very puzzled by a situation here. Basically, i have an branch link with 2 parameters. In my iOS, it is handled in the deeplinkhandler setup during the setup.

However, the link works VERY differently. We installed on the TF on our phones. The app store does not have the version w branch yet.

configuration below:

  • from both of our chrome: works seamlessly, deeplinked works
  • from my phone, iMessage: goes to appstore
  • from his phone, iMessage: goes to app but deep linking does not work

so.....

  1. if it works on chrome, does that mean my integration is done right?
  2. why would it work differently from my phone and another phone, given we have the same OS?
  3. if the main goal is to deeplink properly (like emails), wouldn't it be more effective to do a URL scheme, where we know for certain that the deep link will land ther user where we need?

EDIT: Figured out part of the problem: my device was "disabled for universal links"

Now, it is because continue userActivity is not being called even when the link appears to work! I know because it does not show up in my debug logs, AND when i initialized the app WHEN the deeplink DOES not appear to work, the deeplink is triggered when I open the app. :)

  // This is my method signature, its in an appdelegate EXTENSION.
  // could that be the problem?
  // i am using swift 2.3

  func application(application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: ([Any]?) -> Void) -> Bool {
    application.fuckingComprehensivePrint("application continue in appdelegate")
    return Branch.getInstance().continueUserActivity(userActivity)
  }

EDIT 2: Ok, so all in all, there were THREE problems

  1. My device was disabled for universal links
  2. I put my method signature in an extension
  3. My method signature was wrong (i used swift 3.0 syntax)

I also had URL handling in my app (separate from branch) that caused it to work in some instances.


回答1:


Alex from Branch here: welcome to the crazy world of deep linking — this is why Branch exists :).

To answer your questions:

  1. If things are working correctly in Chrome, it means your implementation is at least partially correct. This is because in some situations Branch can still use a URI scheme redirect with Chrome. If this is the case, your app will open without the 'forward to web' arrow in the top right corner (this is the giveaway that you were just Universal Linked).

    Based on what you're describing (Chrome deep links, but iMessage doesn't), it sounds like your openURL method (URI scheme links) is correctly configured but continueUserActivity (Universal Links) isn't.
  2. Since behavior is different on identical devices, I suspect Universal Links on your device may have become disabled at some point during testing. This is very easy to do — thanks, Apple — but also fairly easy to fix: just paste the link into the iOS Notes app, long-press (not force-press) on the link, and then select Open in [app].
  3. Up until iOS 9, URI schemes were the de facto best option. With Universal Links, and the changes Apple has imposed to force their adoption, URI schemes are an increasingly bad user experience (scary error messages, no fallback ability, etc.). You can read about this in greater detail in this blog post. Plain vanilla URI scheme deep links also cannot work when the app isn't yet installed, and many apps don't recognize them as valid, clickable links so they need to be wrapped inside a regular http link with a redirect.

Branch is a fundamentally different approach to content linking in apps.

Rather than standard links with paths to content, you can think of Branch links as unique tokens that deliver an unlimited number of key:value pairs to you in the app (including — if you really want it — a URI path that can be automatically triggered), in exactly the same way, in every situation.

So rather than needing to handle all the different and constantly-changing standards, trying to detect whether the app is installed when a link is clicked, worrying about which app or browser the user might be using to open the link, etc., all you need to do is wait for the link keys to be delivered. Branch has abstracted all of these technical details out into a separate framework.

It's conceptually different at first, but far more flexible because you're no longer limited to just the data that can be stored in a URI path.



来源:https://stackoverflow.com/questions/40198407/branch-deep-links-works-very-differently-in-different-apps-and-phones

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