10

We have some in-house apps and before iOS 9, the apps will open a link like "itms-services://" after version compare, the new version apps will be downloaded and install.

But after we tested on iOS 9, we found the apps cannot open the link "itms-services://" link, got error like "LaunchServices: ERROR: There is no registered handler for URL scheme itms-services"

The code we used to update the app:

let downloadUrl = NSURL(string: url)
UIApplication.sharedApplication().openURL(downloadUrl!)

We have tested put "itms-services", "itms-services://" and the full URL into "LSApplicationQueriesSchemes" in plist file. But still not work.

Daniel
  • 101
  • 1
  • 1
  • 6
  • Have got the workaround method for this issue. Configure a sub-domain name on an domain and set the new URL to redirect to itms-service:// URL automatically (your DNS service provider always support this), in the app, open the new URL instead of "itms-service" URL, got this from app forum, not tested yet. – Daniel Dec 04 '15 at 05:58

4 Answers4

1

I have come to the same problem with you. And I solve this problem with the method that the app open a html url with safari first,

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http:// xx.xx.xx.xx/xx.html"]];

the html url redirect to the url --- itms-services://?action=download-manifest&url=https://xx.xx.xx.xx/xx/xx.plist address. Though this method can update my app, but the update process need open Safari first and then alert open App Store, if you select open button then it will alert whether install your app, at last you confirm install button. the app will be installed automatically.

my html content as follow:

<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()">
dullgrass
  • 11
  • 1
  • Additionally, the update installing process is the same as open the url tms-services://?action=download-manifest&url=https://xx.xx.xx.xx/xx/xx.plist in the safari – dullgrass Dec 03 '15 at 08:52
0

In iOS9 (in my case my url scheme is: hash:)

Change info.plist: add the custom url schemes here

then register event handler in 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;
}
creality
  • 217
  • 3
  • 9
  • Thanks for your reply, but I'm not defining app owned schema, just want to use the enterprise in-house distribution schema (user can open the URL in safari to install the in-house distribution instead of AppStore). – Daniel Sep 21 '15 at 01:52
0

Don't know it it's your case but you need an https url to download the apps. We don't have an SSL on our website so what we do is upload the .plist to dropbox and use the shared link in the itms-services link. The .plist redirects to your server and we don't have problems

magorich
  • 449
  • 5
  • 17
  • Actually, we have this works in iOS earlier than 9.0, but after update to iOS 9, this cannot be work. Seems the new iOS cannot find an application to open URL start with "itms-services", it should be work as the URL can be open by Safari directly. But cannot open from Application. – Daniel Sep 23 '15 at 02:50
  • @Daniel Check my answer here, maybe it can help you, in our iOs 9 devices it works fine http://stackoverflow.com/a/32769917/1339326 – magorich Sep 24 '15 at 20:02
  • 1
    Thanks for your reply, but actually our problem is not the "installation" but "upgrade", we can install our app on iOS 9 from Safari, but we used the app to upgrade itself by open a URL as "itms-services://", that works on iOS 8 but cannot work on iOS 9. – Daniel Oct 09 '15 at 09:25
  • Oh I see, I have no idea that was possible (good to know) maybe with the new settings of the https and conections of the iOS 9 something is missing in your configuration. But I really don't know how to help you. – magorich Oct 12 '15 at 16:26
0

In iOS 9 you must whitelist any URL schemes your App wants to query in Info.plist under the LSApplicationQueriesSchemes key (an array of strings):

enter image description here

With the schemes included in Info.plist everything works as before. When you link against iOS 9 you are not limited to 50 distinct schemes you just need to declare what you need in Info.plist. There seems to be no limit for how many schemes you can include but I would expect questions from the App Store review team if they think you are abusing the mechanism.

Note that this mechanism only applies to canOpenURL and not openURL. You do not need to have a scheme listed in Info.plist to be able to open it with openURL.

More information at : http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl.html

NSKevin
  • 564
  • 8
  • 20