Two things to keep in mind with saving an NSMutableArrays with NSUserDefaults:
1. All objects returned from NSUserDefaults are immutable.
2. All objects with the array need to be serializable (or property values).
The first one means if you saving something mutable, you have to reconstruct it when you read it back because it is going to be immutable:
NSArray *temp = (NSArray *)[self loadUserDefaultWithKey:PHOTOS_KEY]; self.photos = [NSMutableArray arrayWithArray:temp];
The second one means that whatever you are persisting in your array, it needs to contain property values, or implement some archiving methods so the elements know how to archive, and unarchive themselves when they comes out of storage.
I got caught with this trying to say an ALAsset into a mutable dictionary, and then read it back later. Doesn’t work well because of the second issue.
Here are the error messages you will get.
Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[__NSCFArray insertObject:atIndex:]: mutating method sent to immutable object’
Note that dictionaries and arrays in property lists must also contain only property values.
More links on the subject