从邮件链接打开iOS应用
答
添加以下行到你的plist文件:(DemoTest是我的自定义URL方案)
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>DemoTest</string>
<key>CFBundleURLSchemes</key>
<array>
<string>DemoTest</string>
</array>
</dict>
</array>
然后尝试打开DemoTest://从浏览器的URL,它会问你打开安装该应用程序。
HTML代码:
<html>
<body>
<script type="text/javascript">
window.onload = function() {
// Deep link to your app goes here
document.getElementById("l").src = "DemoTest://";
setTimeout(function() {
// Link to the App Store should go here -- only fires if deep link fails
window.location = "https://itunes.apple.com/us/app/my.app/id123456789?ls=1&mt=8";
}, 500);
};
</script>
<iframe id="l" width="1" height="1" style="visibility:hidden"></iframe>
</body>
</html>
+0
出于好奇:这应该直接从邮件打开应用程序,对吧?或者它会一直打开Safari,然后转换到应用程序? – LinusGeffarth
+0
它会首先重定向到safari,然后“DemoTest://”URL检查是否安装了应用程序。 –
+0
@LinusGeffarth这里是HTML代码: –
这不能从应用程序方面有可能你所要做的后端侧像服务器端编码此。否则的选择是,当你点击创建URL意味着在这里把你的应用程序商店的URL,所以它的开放应用程序商店,如果应用程序安装然后指示你显示选项,打开应用程序或如果不安装,那么你显示安装应用程序选项。 –