创建一个链接,可以启动iOS应用程序,也可以重定向到应用商店 [英] Create a link that either launches iOS app, or redirects to app store

查看:399
本文介绍了创建一个链接,可以启动iOS应用程序,也可以重定向到应用商店的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

是否可以为YouTube应用程序注册基于http +域的URL方案,如YouTube和地图? / p>

Possible Duplicate:
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?

我的iOS应用程序有一个自定义URL方案,我希望能够通过电子邮件发送一个链接到将要启动应用程序的人,如果它在设备上,或者如果他们没有它就将它们带到应用程序商店。

I have a custom URL scheme for my iOS app, and I want to be able to email a link to someone that will either launch the app if it's on the device, or take them to the app store if they don't have it.

我想要能够发送myapp:// someurl并在appstore上启动或转到myapp,但我认为这不会开箱即用。

I'd like to be able to send myapp://someurl and have that either launch or go to myapp on the appstore, but I don't think this will work out of the box.

相反,我正在考虑创建一个链接,加载一些javascript,它将尝试myapp:// someurl,如果失败将改为加载应用商店链接。

Instead, I'm thinking of creating a link that loads some javascript which will try myapp://someurl, and if that fails will instead load the app store link.

我的javascript知识很糟糕。我可以设置window.location来执行重定向,但似乎没有办法从中捕获错误,以便在失败时执行另一个操作。

My javascript knowledge is crappy. I can set window.location to perform the redirect, but there doesn't seem to be a way to catch errors from that in order to perform another action if that fails.

任何人都知道怎么做?

推荐答案

检查
是否可以注册一个http +域名 - 基于URL方案的iPhone应用程序,如YouTube和地图?

但是你需要自己托管包含脚本的页面,因为javascript里面的电子邮件没有'工作

You do however need to host the page containing the script yourself, since javascript inside email doesn't work

这篇关于创建一个链接,可以启动iOS应用程序,也可以重定向到应用商店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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