2

I'm working on an enterprise app that is distributed itms-services.

This app has a service that lets the user know when there is an update, so when the user press the update button the app calls itms-services to download and install the latest version.

Until iOS 8 when itms-services is called from an app the system would close the app and start the update process. Now there is an annoying change where the app isn't close anymore, the user doesn't know that the update process has started.

I would like to close my app after the update started like it was before iOS 8, but I don't know if this is possible, I thought to add an feedback saying that the app is been updated but this doesn't seem a good solution for me.

Does anyone know a better solution for this?

UPDATE: This app is also distributed at the App Store, so I can't use anything that could cause a rejection by Apple.

Thanks

  • Can you try call Home button after the update started, or try close the app by using ? ' [[NSThread mainThread] exit] ' – Luo Sen Oct 07 '14 at 16:44
  • Yes the user can use the home button. Is it okay to call [[NSThread mainThread] exit]? Do you know if Apple would aprove this? This app is also distributed at the App Store. – Franco Carbonaro Oct 07 '14 at 18:20
  • [[NSThread mainThread] exit] is the right way to close the app! but i do not know if you actually need to close it before updating. the native way of updating is just to hit home – Luo Sen Oct 07 '14 at 18:26
  • I would like to close because it seems that nothing happened now, a feedback could handle this but I would like to know if there is a proper way to do this. – Franco Carbonaro Oct 07 '14 at 18:39
  • as far as i know Home button is the proper way to do before update, but in terms of closing app, [[NSThread mainThread] exit] is the proper way! you could do some research to see what other people say! – Luo Sen Oct 07 '14 at 19:48
  • I'm also wondering if it's possible to detect whether user did press Install or Cancel on system confirmation dialog – heximal Dec 04 '14 at 13:30

2 Answers2

2

You can call

[[UIApplication sharedApplication] performSelector:@selector(suspend)];

to put the app in the background right after opening your itms URL.

James Moore
  • 389
  • 2
  • 7
  • This works really well for me. Franco: Why don't you use this code, but make sure to remove it when you build for the app store? It's a different build anyway right? (Must be a different provisioning profile at least). Add a preprocessor directive to remove it on App Store builds and Apple will not reject your app. – Jesper Schläger Nov 05 '14 at 09:25
0

The update process in iOS 8 does not stop execution of the app until the update is complete. If you watch your home screen while the update is in progress, you will see two icons for the same app. After the update is complete, the "updating" icon will disappear and your app will have been updated.

If you're releasing an enterprise app, you're probably not going through Apple's review process. You might look into using private methods for closing your application when an in-app update flow is triggered. You could even cause a crash if you wanted (like try to access an index of an array out of bounds), though you'll probably get crash reports. ;)

Ian MacDonald
  • 13,472
  • 2
  • 30
  • 51
  • I can't use private methods because I the same app is distributed at App Store, only some of our clients use enterprise distribution. About the second icon it's not my case, I read about people saying that the second item might be created when the bundle id isn't the same (http://stackoverflow.com/questions/25772664/enterprise-app-update-distribution-on-ios-8). While my app is running the download process starts and the installing process will only start when the app isn't running in foreground. Thanks – Franco Carbonaro Oct 07 '14 at 18:10
  • Are you sure there's only one icon on iOS 8? The icons will not necessarily appear on the same page of your home screen. In my experience, there have always been two since updating to iOS 8 -- even when the bundle identifier doesn't change. This second icon shows until the update is complete and then disappears. – Ian MacDonald Oct 07 '14 at 18:12
  • In my case the new icon is replacing the current one, and it would be perfect if the execution was stopped. – Franco Carbonaro Oct 07 '14 at 18:15