【发布时间】:2012-04-25 05:10:21
【问题描述】:
可能重复:
Storing custom objects in an NSMutableArray in NSUserDefaults
How to store custom objects in NSUserDefaults
我试图将一个从我编写的名为“Animal”的类实例化的对象存储在 NSMutableArray 中,以存储在 NSUserDefaults 中。但是,我收到此错误。
[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '(
"<Animal: 0xcea7060>"
)' of class '__NSArrayM'. Note that dictionaries and arrays in property lists must also contain only property values.
这是什么意思?也许我不能将对象存储在 NSMutableArrays 中以存储在 NSUserDefaults 中?
【问题讨论】:
标签: objective-c ios