10

我们有一些内部应用程序,在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”中。但还是不行。

4

4 回答 4

1

我和你遇到了同样的问题。我用应用程序首先用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()">
于 2015-12-03T08:14:46.450 回答
0

在 iOS9 中(在我的情况下,我的 url 方案是:hash :)

更改 info.plist: 在此处添加自定义 url 方案

然后在 appdelegate 中注册事件处理程序:

 func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
    // do what you want to do
    print(url);

    // return true if url matches scheme
    return true;
}
于 2015-09-19T13:26:03.057 回答
0

在 iOS 9 中,您必须将您的应用想要在 Info.plist 中的 LSApplicationQueriesSchemes 键(字符串数组)下查询的任何 URL 方案列入白名单:

在此处输入图像描述

使用 Info.plist 中包含的方案,一切都像以前一样工作。当您链接到 iOS 9 时,您不限于 50 个不同的方案,您只需在 Info.plist 中声明您需要的内容。您可以包含多少个方案似乎没有限制,但如果 App Store 审核团队认为您在滥用该机制,我希望他们会提出问题。

请注意,此机制仅适用于 canOpenURL,不适用于 openURL。您不需要在 Info.plist 中列出一个方案就可以使用 openURL 打开它。

更多信息请访问:http ://useyourloaf.com/blog/querying-url-schemes-with-canopenurl.html

于 2015-11-24T04:36:30.613 回答
0

不知道这是你的情况,但你需要一个 https url 来下载应用程序。我们的网站上没有 SSL,所以我们所做的是将 .plist 上传到保管箱并使用 itms-services 链接中的共享链接。.plist 重定向到您的服务器,我们没有问题

于 2015-09-22T21:43:56.897 回答