重定向到应用程序,如果安装了,否则的AppStore [英] redirect to application if installed, otherwise to appstore

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

问题描述

我知道这是可以直接链接到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?

添加为清楚起见的情况是,我打开我的iPhone是在邀请我加入一个组中的应用,从电子邮件的链接(HTTP)。如果用户安装了该设备应该打开应用程序,否则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为predefined URL服务器上

  2. 在该URL设置了一个cookie,像appInstalled用户的移动Safari浏览器

  3. 您接着踢用户返回到您的应用程序与你的注册计划(同FB确实与SSO)

  4. 所有的电子邮件链接指向你的网站,但在网站上,你检查浏览器是移动Safari浏览器,如果appInstalled cookie存在

  5. 如果任一浏览器不移动Safari或cookie不会找到,您重定向到AppStore的,或者留在你的网页。

  6. 如果#4的条件为真,你将用户重定向到与注册计划
  7. 您的应用程序
  8. 如果该应用程序已被用户删除,因此自定义URL方案失败了,你有一个故障安全重定向到AppStore的

  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的最后一个步骤是在这说明 SO帖子

The 2 last steps are explained on this SO post

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

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