我们有一些内部应用程序,在 iOS 9 之前,应用程序会在版本比较后打开一个类似“itms-services://”的链接,然后下载并安装新版本的应用程序。
但在 iOS 9 上测试后,我们发现应用程序无法打开“itms-services://”链接,出现类似“LaunchServices: ERROR: There is no registered handler for URL scheme itms-services”的错误
我们用来更新应用的代码:
let downloadUrl = NSURL(string: url)
UIApplication.sharedApplication().openURL(downloadUrl!)
我们已经测试将“itms-services”、“itms-services://”和完整的 URL 放入 plist 文件中的“LSApplicationQueriesSchemes”。但还是不行。
最佳答案
我和你遇到了同样的问题。我通过应用程序首先使用 safari 打开 html url 的方法解决了这个问题,
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http:// xx.xx.xx.xx/xx.html"]];
html url 重定向到 url --- itms-services://?action=download-manifest&url= https://xx.xx.xx.xx/xx/xx.plist地址。虽然这种方法可以更新我的应用程序,但是更新过程需要先打开Safari然后提示打开App Store,如果你选择打开按钮然后它会提示是否安装你的应用程序,最后你确认安装按钮。该应用程序将自动安装。
我的html内容如下:
<html>
<head>
<metahttp-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript">
function load()
{
window.location ="itms-services://?action=download-manifest&url=https://xxx/xx/xx.plist";
}
</script>
</head>
<body onload = "load()">
关于iOS 9 启动服务 : ERROR: There is no registered handler for URL scheme itms-services,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32652083/