简体   繁体   English

如何创建将被识别为链接的自定义网址方案?

[英]How do I create a custom url scheme that will be recognized as a link?

My url scheme looks like "foo://". 我的网址方案看起来像“ foo://”。

This works great when I type into the browser. 当我在浏览器中键入内容时,此功能非常有用。

The application requires I send this link in an e-mail and the e-mail opens from there. 该应用程序要求我通过电子邮件发送此链接,然后从那里打开电子邮件。 How can I configure the url scheme to be recognized as a link? 如何配置URL方案以将其识别为链接? I tried doing http://foo:// but of course my browser caught that. 我尝试做http://foo://但是我的浏览器当然捕捉到了这一点。

One solution is to ping my server http://foo.com/redirect_to_app . 一种解决方案是对服务器http://foo.com/redirect_to_app进行ping操作。 If there is a way to do this with the app only I would like to know. 如果有一种方法可以通过该应用程序进行操作,那我只是想知道。

If you put the URL as foo:// in the email body, then that is all you need to do. 如果将URL作为foo://放置在电子邮件正文中,那么您只需要做。 Of course it requires that the user reads the email using the Mail app on their iOS device and the user must have your app installed on their iOS device as well. 当然,这要求用户在其iOS设备上使用“邮件”应用程序阅读电子邮件,并且用户还必须在其iOS设备上也安装了您的应用程序。

Your foo:// URL will mean nothing if the email is read on a non-iOS device or computer or if the user doesn't have your app installed. 如果在非iOS设备或计算机上阅读电子邮件,或者用户未安装您的应用,则foo:// URL无效。

This all assumes that your goal is for one user of your app to send an email to another user of your app and tapping on the link in the email will launch your app on the receiver's iOS device. 所有这些都假定您的目标是让应用程序的一个用户向应用程序的另一个用户发送电子邮件,然后点击电子邮件中的链接将在接收者的iOS设备上启动您的应用程序。

There is a way. 有一种方法。 You need to create a webpage and create redirect code(url scheme) to your app. 您需要创建一个网页并为您的应用创建重定向代码(URL方案)。 Check this out... Check if URL scheme is supported in javascript 检查一下... 检查javascript是否支持URL方案

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

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