Graphics Programs Reference
In-Depth Information
When the user presses the home button on the device, the message applica-
tionDidEnterBackground: is sent to the HomepwnerAppDelegate . That's
when we want to send saveChanges to the BNRItemStore .
In HomepwnerAppDelegate.m , implement applicationDidEnterBack-
ground: to kick off saving the BNRItem s. Make sure to import the header file for
BNRItemStore at the top of this file.
#import "BNRItemStore.h"
@implementation HomepwnerAppDelegate
- (void)applicationDidEnterBackground:(UIApplication *)application
{
BOOL success = [[BNRItemStore sharedStore] saveChanges];
if (success) {
NSLog(@"Saved all of the BNRItems");
} else {
NSLog(@"Could not save any of the BNRItems");
}
}
(This method may have already been implemented by the template. If so, make sure to
add code to the existing method instead of writing a brand new one.)
Build and run the application on the simulator. Create a few BNRItem s. Then, click the
home button to leave the application. Check the console, and you should see that all of the
Search WWH ::




Custom Search