Jon
Jon

Reputation: 5

iOS4 removing app from memory via code

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

Upvotes: 0

Views: 525

Answers (3)

Terry
Terry

Reputation: 621

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).

Upvotes: 0

Christopher Pickslay
Christopher Pickslay

Reputation: 17782

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

Upvotes: 1

stubear
stubear

Reputation: 58

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.

Upvotes: 1

Related Questions