You must encode / decode the objects in your object (which is in your array) and archive the array in NSData.
Just add
<NSCoding>
into the class of your objects (in your array) and follow the warnings of your compiler: D
Then archive your array as follows:
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:yourArray];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:data forKey:@"yourKey"];
NSArray *array= [NSKeyedUnarchiver unarchiveObjectWithData:[defaults objectForKey:@"yourKey"];
Check this out http://soff.es/archiving-objective-c-objects-with-nscoding
source
share