简体   繁体   English

如果iOS设备上未安装应用程序,则通用链接无效

[英]Universal link not working if app is not installed on an iOS Device

I've implemented universal links in my application as well as server side. 我已经在我的应用程序和服务器端实现了通用链接。 Everything works fine when the app is installed. 安装应用程序后,一切正常。 If the app is not installed on the device and I click on the universal link from say notes or mail, I'm redirected to the app store from where I can download the app. 如果设备上没有安装应用程序,我点击说明或邮件的通用链接,我会被重定向到我可以下载应用程序的应用程序商店。 On download completion however, if I click 'OPEN' in the app store page, the app delegate method below is not called: 但是,在下载完成时,如果我在应用程序商店页面中单击“打开”,则不会调用下面的应用程序委托方法:

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler

As a result, I cannot perform certain actions in response to the userActivity.webpageURL that I would normally get when the app is running or previously installed on a device. 因此,我无法执行某些操作以响应当应用程序运行或以前安装在设备上时通常会获得的userActivity.webpageURL Is this normal behaviour? 这是正常的行为吗? ie If the app is not installed, the Universal link will only serve as a medium to install the app from the app store? 即如果未安装该应用,通用链接将仅作为从应用商店安装应用的媒介?

The only way you can achieve this is through device fingerprinting mechanism. 实现这一目标的唯一方法是通过设备指纹识别机制。 This is how providers like Branch, Adjust, GetSocial , Appsflyer, Tune, Kochava etc perform contextual deeplinking, deferred deeplinking, attribution, and tracking. 这就是像Branch,Adjust, GetSocial ,Appsflyer,Tune,Kochava等提供商执行上下文深层链接,延迟深层链接,归因和跟踪的方式。

If you don't want to use any of the providers mentioned above, and if you just want a very basic device fingerprinting mechanism then you can do so by using only IP address. 如果您不想使用上面提到的任何提供程序,并且您只想要一个非常基本的设备指纹识别机制,那么您可以通过仅使用IP地址来实现。 This is a very nice article from Tune on different methodologies used for attribution. 是Tune关于归因的不同方法的一篇非常好的文章。

(Disclaimer: I am the founder of GetSocial) (免责声明:我是GetSocial的创始人)

That's exactly how universal links are supposed to work. 这正是通用链接应该如何工作的原因。 If the user didn't have your app, the download is a brand new session instead of a continued user activity. 如果用户没有您的应用,则下载是全新的会话,而不是持续的用户活动。

I believe branch.io offers an SDK that allows for continuity for new installs. 我相信branch.io提供了一个SDK,可以保证新安装的连续性。

Edit: 编辑:

Ok, I did some digging and this is called deferred deep linking. 好吧,我做了一些挖掘,这被称为延迟深度链接。 It's not officially supported by Apple Universal links. Apple Universal链接没有正式支持。

But here's basically how branch does it: 但这里基本上是分支如何做到的:

  • When the new users visits your site, you store a unique token in the cookies for you website. 当新用户访问您的网站时,您会在网站的Cookie中存储唯一的令牌。
  • Then when the app is opened for the first time, you check for that token using SafariServices 然后,当第一次打开应用程序时,您使用SafariServices检查该令牌
  • If the token is present, run your continuity code. 如果令牌存在,请运行您的连续性代码。

Here's a more detailed article about all the linking types in iOS. 这是一篇关于iOS中所有链接类型的更详细的文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM