When saving an array in the userdefaults开发者_Go百科 using the setObject
method, is it then ok to just setObject:myMutableArray
or do I need to wrap it in
[NSArray arrayWithArray:myMutableArray];
? The first one should work right? Since it is a subclass of NSArray, and it wont affect other things?There's not a problem with what you're trying to do, however bear in mind that when you get an object back from user defaults you always get it immutable.
A nice approach can be found here to make it easy to work it.
精彩评论