可能重复:
Storing custom objects in an NSMutableArray in NSUserDefaults
How to store custom objects in NSUserDefaults如何将对象添加到NSMutableArray中以存储在NSUserDefaults中?
我试图存储从一个类实例化一个对象我编写的名为 “动物” 在一个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中?
的可能重复[如何在存储NSUserDefaults的自定义对象(http://stackoverflow.com/q/2315948/);也http://stackoverflow.com/q/7459585/,http://stackoverflow.com/q/537044/和http://stackoverflow.com/q/471830/ – 2012-04-12 19:48:28