2017-08-02 108 views
0

我的问题是我能做些什么来将自定义URL方案转换为可打开应用程序的QR码。将自定义URL方案转换为QR码(IOS)

比方说,我有一个自定义URL(myScheme://)。如果我在手机的浏览器上输入它,它会起作用。 但是,如果我只是通过一些在线qr代码生成器进行转换,则qr代码阅读器不会打开浏览器中的网址,只是返回纯文本。

这是否意味着我需要建立一个自己的QR码阅读器来处理它?

+0

如果url方案在浏览器/ webview中打开或者是您的web上的实际url并重定向到您的应用方案,那么它将起作用,否则它只是纯文本 – Tj3n

+0

您是否意味着我需要构建一个实际的url来重定向应用程序方案? – starf15h

回答

0

我认为这取决于QR码阅读器应用程序。在我的情况下,我有一个自定义URL(itms-services://?action=download-manifest&url=xxxQR Reader for iPhone的作品。但一些客户说:“我无法安装应用程序,QR只是打开Safari。”有很多QR阅读器应用程序,我们不知道使用哪一个。

但是你可以用你自己的网站像this

<!doctype html> 
<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    <meta name="viewport" content="width=device-width,minimum-scale=1.0, maximum-scale=1.0" /> 
    <title>Site Name</title> 
    <style>@media screen and (max-device-width:480px){body{-webkit-text-size-adjust:none}}</style> 

    <!-- implement javascript on web page that first first tries to open the deep link 
     1. if user has app installed, then they would be redirected to open the app to specified screen 
     2. if user doesn't have app installed, then their browser wouldn't recognize the URL scheme 
     and app wouldn't open since it's not installed. In 1 second (1000 milliseconds) user is redirected 
     to download app from app store. 
    --> 
    <script> 
    window.onload = function() { 
    <!-- Deep link URL for existing users with app already installed on their device --> 
     window.location = 'yourapp://app.com/?screen=xxxxx'; 
    <!-- Download URL (MAT link) for new users to download the app --> 
     setTimeout("window.location = 'http://hastrk.com/serve?action=click&publisher_id=1&site_id=2';", 1000); 
    } 
    </script> 
</head> 
<body> 

    <!-- button to Download App for new app users --> 
    <form action="http://hastrk.com/serve?action=click&publisher_id=1&site_id=2" target="_blank"> 
     <input type="submit" value="Download" /> 
    </form> 

    <!-- button to Open App to specific screen for existing app users --> 
    <form action="yourapp://app.com/?screen=xxxxx" target="_blank"> 
     <input type="submit" value="Open App" /> 
    </form> 

</body> 
</html> 

然后,你应该与网站的网址生成QR。它将在Safari中打开并重定向您的应用程序。 (我希望如此。)

+0

所以我可能需要使用C#.net来创建一个网页,然后发布它,对吧? – starf15h

+0

只需创建一个html页面并发布它。 –