views:

71

answers:

2

Hi all! In my app I need to avoid the saving state, in fact, I whis that each time the user starts the app, the app will be relaunced like the first time... how can I do?

A: 

You don't have to do a thing. iOS does nothing to save the state of your app.

Nikolai Ruhe
it's strange, I created a new app and when I relaunch the app for the 2nd time, the app appears with the latest view shown..
ghiboz
It does, starting from 4.0. Technically, it doesn't *save* the app's state but freezes it in memory. The net effect is your app (given it doesn't get killed) resumes where it was left off the last time.
Can Berk Güder
right... and it's possible to avoid this?? ;)
ghiboz
@ghiboz: it is. see my answer.
Can Berk Güder
Also, see this blog post by Dr. Touch for more information: http://www.drobnik.com/touch/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/
Can Berk Güder
@ghiboz - It's highly recommended that you allow your application to work with iOS 4.0's multitasking. You need a very good reason why your application would need to start over at the beginning every time, because that provides a poor user experience. If possible, figure out a way to make your application work with multitasking.
Brad Larson
+2  A: 

Set UIApplicationExitsOnSuspend to YES (Boolean) in your Info.plist.

Can Berk Güder