March 2012
Intermediate to advanced
590 pages
22h 48m
English
You now have a place to save data on the filesystem and a model object that can be saved to the filesystem. The final two questions we must answer are: how do we kick off the saving and loading processes and when do we do it? To save BNRItems, you will use the class NSKeyedArchiver when the application “exits.”
In BNRItemStore.h, declare a new method.
- (BOOL)saveChanges;
Implement this method in BNRItemStore.m to send the message archiveRootObject:toFile: to the NSKeyedArchiver class.
- (BOOL)saveChanges { // returns success or failure NSString *path = [self itemArchivePath]; ...Read now
Unlock full access