I have some data structures in my app that I need to persist upon receiving 'didReceiveMemoryWarning' notification. The data is kind of a running log of all of the actions the user has performed with the app (which is a game)
The data I have may not be a small amount (possible > few hundred KB) so plists don't seem to be the right solution.
The first of two possibilities is archiving objects and making these objects support NSCoding protocol. I'm not sure if this is the right path to choose.
The second option seems to be with CoreData, using NSManagedObjectModel and NSPersistentStoreCoordinator. Is this a good way to store these objects? Or is it overkill? (I'm using the 'Recipes' sample app from Apple for reference).
My objects are custom object types which eventually hold NSString, NSNumber, NSInteger and other simple types.
Sample of some of the data types I have:
// this the base object I need to start with to persist
@interface MyDataObject : NSObject
{
MyScore *aScore;
// Contains an object of type 'MyAction'
NSMutableArray *allActions;
}
@interface MyScore : NSObject
{
NSInteger currentScore;
NSDate lastUpdated;
}
@interface MyAction
{
NSNumber *actionId;
NSString *description
MyUser *associatedUser;
}
@interface MyUser
{
NSNumber *id;
NSString *name;
NSString *email;
}
User can play a bunch of different games and for each game, I have an activity log of what moves they've made. The user can see the moves they've made so far in each game while they're playing it and they can also switch between active & inactive games so they can review the past moves as well.