简体   繁体   English

iPhone:URL方案无法从邮件客户端工作

[英]iPhone: URL scheme not working from mail client

I have created URL schemes in my app. 我在我的应用程序中创建了URL方案。 I just wanted to open my app from an email. 我只是想通过电子邮件打开我的应用程序。 I copy the custom URL scheme myapp:// in browser and it is opening my app. 我在浏览器中复制自定义URL方案myapp://并打开我的应用程序。 But when I try opening it from email in iOS mail client, it doesn't open. 但是,当我尝试从iOS邮件客户端的电子邮件中打开它时,它无法打开。 Is there anything extra needed to be done to open my app from email? 从电子邮件中打开我的应用程序还有什么需要做的吗?

In e-mail body, you should write content in html format. 在电子邮件正文中,您应该以html格式编写内容。 Here you require a hyperlink so there should be <a href> ... </a> 在这里你需要一个超链接,所以应该有<a href> ... </a>

For example: 例如:

<a href="myapp://">Launch MyApp</a>

Hope this helps. 希望这可以帮助。

Unfortunately, some email clients just don't handle custom URLs properly. 不幸的是,某些电子邮件客户端无法正确处理自定义URL。

One solution is to get the browser to open the link instead of the email client. 一种解决方案是让浏览器打开链接而不是电子邮件客户端。 Just host a web-page with a redirect somewhere, and redirect to your custom link. 只需托管一个带有重定向的网页,然后重定向到您的自定义链接。

For example, a php page: 例如,一个php页面:

<?php
    $arg = $_GET["arg"];
    $url = "myapp://host?arg={$arg}";
    header("Location: {$url}");
?>

Then put a normal link in the email: 然后在电子邮件中放入一个普通链接:

http://www.example.com/openurl.php?arg=123

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

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