Possible Duplicate:
IOS3 Compatible App in IOS4 Mutlitasking
I have made a quiz application and I need to save the state (timer, an array of question ids, an array containing dictionary objects which says something about what the user has answered and the current index) when the user either press home button or in case of a phone call etc.
However the application will be running at iOS versions < 4.0, so in some cases the multitasking won't be possible.
I have written this, but I can't get notifications for this UIApplicationWillResignActive
on iOS 3.1.3 (actual device), on iOS >= 4.0 it works. and I also commented out the UIApplicationWillEnterBackground notification because the app crashes when it is run on a iOS 3.1.3 device, because the notification name isn't available. How can I check if it is available like I do with methods?
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(saveState) name:UIApplicationWillResignActiveNotification object:nil];
//[nc addObserver:self selector:@selector(loadState) name:UIApplicationWillEnterForegroundNotification object:nil];
Which notification names should I register for and how do save/load state on iOS systems without multitasking and those with?
Thank you.