3

I am working on a way to update an enterprise app OTA. I am opening a url to a copy of my app from my own server inside the app when I detect a new version is available. This works well except I want to give the user the option of not updating the app if they don't want to. What I would like to know is if there is any sort of notification that is sent to the ios app if the user presses cancel in the dialog that pops up when the url is opened. In other words I want a way for the app to continue ONLY if the user cancels the update request.

Here is the code I am executing to update the app.

NSURL *url = [NSURL URLWithString:@"itms-services://?action=download-manifest&url=http://www.mywebsite.com/myapp.plist"];
if (![[UIApplication sharedApplication] openURL:url]) {
    NSLog(@"%@%@",@"Failed to open url:",[url description]);
}

I wasn't able to find any information what-so-ever about the itms protocol in the apple developer docs. I was able to achieve the effect I wanted by presenting a custom UIAlertView asking the user if they wanted to update before opening the url, but this has the unfortunate side-effect of prompting the user twice if they want to update, and still doesn't really handle the case where they cancel the update after the first prompt.

Any help on the matter would be appreciated.

Matt C.
  • 689
  • 5
  • 14
  • Just some follow-up on what I think MAY be happening. I'm pretty sure the dialog that appears on screen isn't being launched from the app itself, but is probably being launched by the default browser. If that's the case I would image my app isn't even running in the foreground. If that's the case, is there maybe a way to detect that the app has come back into the foreground when the user presses cancel? – Matt C. Oct 18 '12 at 18:19
  • Hmm... scratch that last line of thinking. I registered for some notifications to see if my app ever enters or leaves the foreground during the process, and it does not. It does trigger the UIApplicationDidBecomeActiveNotification but that happens regardless of whether install or cancel is selected. – Matt C. Oct 18 '12 at 18:25

0 Answers0