Saving an NSDictionary of NSArrays of custom objects

空扰寡人 提交于 2019-12-09 04:30:31

[NSDictionary writeToFile: atomically:] uses NSPropertyListSerialization, which can only record a subset of primitive objects (numbers, strings, dates and data). So while you could use NSCoding along with NSKeyedArchiver to archive the objects, another option is to marshal your objects into a string or data representation, store that in the property list, and unmarshal them again on loading.

Yes, you want to use a NSKeyedArchiver

All the info you need can be found here:

http://developer.apple.com/library/ios/ipad/#documentation/Cocoa/Conceptual/Archiving/Archiving.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!