views:

136

answers:

3

Is there a way (with iOS4) when the user hits the home button (in order to exit an application) to convey to the iOS4 system to not keep the app running in the background but to remove the app completely from memory (like iPhone 3)? My app could potentially display sensitive information and I'd like for it to exit completely.

Thanks

A: 

Try adding "Application does not run in background" too the pList, I added this to one of our app and it seems to start it from scratch every time..although it still keeps in task manager. So aslong as your app handles the clearing of memory you should be fine.

stubear
Both stubear and chrispix are correct. The raw key name for "Application does not run in background" is UIApplicationExitsOnSuspend. I also noticed that the app icon remains in the task window (when double tapping home-key) even after the app terminates, however, the app is not running in the background.
Jon
A: 

You need to set the key UIApplicationExitsOnSuspend to YES in your application's info.plist.

chrispix
A: 

You could also just modify your app so that in applicationDidBecomeActive: you could detect if you are displaying sensitive information and if you modify the view so either you aren't or that you go to some other screen that is more appropriate.

There are many other places that you could put code to be notified of transitions between active and inactive and you could modify your view in any of those places so that you are no longer showing sensitive material. This would allow you to still retain the other benefits of having your app in memory (like faster load times).

Terry