本文介绍了如果安装,则重定向到应用程序,否则重定向到App Store的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可以通过注册自定义方案(例如so://)直接链接到iOS中的应用程序,也可以通过iTunes链接到appstore中的应用程序。

I know it's possible to link directly to an app in iOS by registering a custom scheme (e.g. so://) and it's also possible to link to the app in the appstore via itunes.

在许多情况下,理想的流程是提供一个链接,重定向到应用程序如果已安装,如果没有,则重定向到商店。这是可能的,如果是的话,怎么样?

In many cases, the ideal flow is to provide a link that redirects to the app if it's installed and to the store if not. Is this possible, and if so, how?

为了清晰起见,情节是我正在打开一个链接(http)我的iphone上的电子邮件邀请我加入应用程序中的一个组。如果用户在该设备上安装了应用程序,则应该打开,否则http链接应该重定向到iTunes。

Added for clarity, the scenario is I'm opening a link (http) from an e-mail on my iphone that's inviting me to join a group in an application. If the user has the app installed on that device it should open, otherwise the http link should redirect to itunes.

推荐答案

没办法检查这个。
然而,有一个很好的解决方法。

There is no way to check for this.However, there is a nice workaround.

这个想法基本上是这样的:

The idea is basically this:


  1. 首次打开应用程序时,您可以在应用程序中打开移动Safari,并在服务器上打开预定义的URL

  2. 在该URL上设置cookie,如app安装到用户手机游戏

  3. 然后用你的注册方案将用户踢回你的应用程序(与FB对SSO相同)

  4. 全部您的电子邮件链接指向您的网站,但在网站上您检查浏览器是否为移动版Safari以及是否存在appInstalled cookie

  5. 如果浏览器不是移动版Safari或cookie不是发现,您重定向到AppStore,或留在您的网页。

  6. 如果#4的条件为真,您将用户重定向到具有注册方案的应用程序

  7. 如果用户已删除该应用,则自定义网址方案失败,您将自动重定向到应用商店

  1. The first time you open your app, you open up mobile safari from within your app to a predefined URL on your server
  2. On that URL you set up a cookie, like appInstalled to the users mobile safari
  3. You then kick the user back to your app with your registered scheme (same as FB does with SSO)
  4. All your email links point to your website, but on the website you check if the browser is mobile Safari and if the appInstalled cookie exists
  5. If either the browser is not mobile Safari or the cookie is not found, you redirect to the AppStore, or stay in your webpage.
  6. If the conditions of #4 are true, you redirect the user to your app with the registered scheme
  7. If the app has been deleted by the user, so the custom url scheme fails, you have a fail-safe redirect to the appstore

解释了最后2个步骤

这篇关于如果安装,则重定向到应用程序,否则重定向到App Store的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 00:18