How to save an NSMutableArray containing NSMutableArrays of custom objects in NSUserDefaults
I was able to save an NSMutableArray of custom objects to NSUserDefaults by implementing NSCoding in the custom class. However, now I want to save an NSMutableArra开发者_StackOverflow中文版y of these arrays. The compiler complains when I try to do this. How can this be done?
I found out how to do it. Basically, your transform the array into a data object using NSKeyedArchiver, and that is what you save with NSUserDefaults. Then when you get the data object back, you use NSKeyedUnarchiver to turn it back into an array.
精彩评论