Search code examples
objective-cmultitaskingsaving-data

How to save data before app enters multasking


Im trying to find a way to save data before my app enters multitasking, i know how to save data, but i dont know what method to use to save it before the app enters multitasking.

-(void)applicationDidEnterBackground:(UIApplication *)application{

this one? because i have everything set up to save, but it doesn't seem to be saving it, and im positive that its the multitasking part because it works on the ios 3 simulator. Do i have to save it in the delegate?

Thanks, Jacob

EDIT: On the IOS 3 one i have it saving data in the

- (void)applicationWillTerminate:(UIApplication *)application {

Solution

  • Yes Jacob, You have to save it in the application delegate of your app.

    The method -(void)applicationWillResignActive:(UIApplication *)application gets called when the device enters standby mode or when the app is switched to background. So the saving part you can add to this method .

    Also to make the app save data for iOS versions < 4.0 , add the saving code to applicationWillTerminate: also.