2017-08-02 112 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頁面併發布它。 –