views:

18

answers:

2

Hellow All, I am developing one game application for iphone.Here whenever user get the call or SMS or he quit the appication ,my application should be in pause state .so,whenever he loads the application again,it should go to previous state where it stopped. Are there any built-in methods for doing this Thanks all

+1  A: 

Implement notification for UIApplicationWillTerminateNotification (and probably UIApplicationWillResignActiveNotification as well). That way your objects can save their state, and restore it when the application is relaunched. There are notifications for that, too, but you are more likely to want to read in the old state data when the objects receive their init calls.

You should consider all the usual storage mechanisms for state - NSUserDefaults, plists, and CoreData. The choice is up to you.

Paul Lynch
A: 

It is you who have to handle all this stuff. You have to save your object state into some file and reload the file when the app re-launches. The system provides you an opportunity to save the state by throwing notifications where in you have little time to archive your objects. Try to design your app such that the objects are not heavy weight and prioritize the object archiving tasks.

Raj