开发者

NSUserDefaults and NSMutableArray

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜