NSKeyedArchiver, a concrete subclass
of NSCoder, provides a way to encode
objects (and scalar values) into an
architecture-independent format that
can be stored in a file.
So you can serialize anything you like to a file:
// need a path
- (NSString*) getPath
{
NSString* path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
return [path stringByAppendingPathComponent:@"someInfo"];
}
// save an array
- (void) save:(NSArray*)array
{
[NSKeyedArchiver archiveRootObject:array toFile:[self getPath]];
}
// get that array back
- (NSArray*) load
{
return [NSKeyedUnarchiver unarchiveObjectWithFile:[self getPath]];
}
You might want to serialize a dictionary of arrays if you have more than one you want to store.