创建一个启动 iOS 应用程序或重定向到应用程序商店的链接

发布于 2024-10-11 08:40:17 字数 614 浏览 14 评论 0原文

可能的重复:
是否可以为 iPhone 应用(例如 YouTube 和地图)注册基于 http+ 域的 URL 方案?

我有一个适用于我的 iOS 应用程序的自定义 URL 方案,并且我希望能够通过电子邮件将链接发送给可以启动如果设备上有该应用程序,则下载该应用程序;如果没有该应用程序,则将其带到应用程序商店。

我希望能够发送 myapp://someurl 并启动或转到应用程序商店上的 myapp,但我认为这不会开箱即用。

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

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

有人知道该怎么做吗?

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

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.

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.

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.

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.

Anyone know how to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

巴黎夜雨 2024-10-18 08:40:17
 window.launchsockPicker = function() {
       setTimeout(function() {
        window.location = 'http://myDomain.com/install-app.cfm'
       }, 500);

       window.location = 'myApp://?context=someVariableIfNeeded';
   };
 window.launchsockPicker = function() {
       setTimeout(function() {
        window.location = 'http://myDomain.com/install-app.cfm'
       }, 500);

       window.location = 'myApp://?context=someVariableIfNeeded';
   };
薯片软お妹 2024-10-18 08:40:17

没有什么好的方法可以实现这一点。您可以通过 URL 启动应用程序,但无法先测试应用程序是否已安装。

There is no good way to achieve this. You can launch an app via a URL but there is no way to test whether an app is installed first.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文