Need help with serialization using custom class objects
Need help with serialization using custom class objects
- Subject: Need help with serialization using custom class objects
- From: James <email@hidden>
- Date: Fri, 03 Jun 2005 13:41:06 -0700
Maybe I'm more of a newbie than I thought, but I can't seem to properly
grasp the concept of serializing to a plist with data from a custom class.
I've created a custom class that contains data pertaining to a book (call it
MyBook). It's got fields for author, genre, ISBN, and so on; nothing too
fancy there. I understand using an array of MyBook objects to populate an
NSTableView, and I understand using NSArchiver to archive the array of
MyBook objects to a file. What I don't understand is using
NSPropertyListSerialization to serialize the data to a plist format and also
reading data from that plist back into an array of MyBook objects.
I want to save my data as a plist rather than a simple archive for expanded
compatibility and also because it seems to be a better way to save data. I
just don't understand how to fit this serialization in with my current
setup. I want to keep the array of MyBook objects for use with the
NSTableView, but I don't see how to serialize the data in the array and load
it back. I know that NSDictionaries are usually used with serialization.
Should I convert my MyBook objects into NSDictionaries to serialize and then
from NSDictionaries back into MyBook objects for use in the datasource?
I'm sorry if I'm not explaining this problem properly. Maybe if someone
could give me a general tutorial on serializing with custom classes that
would help? I know that there is some piece of the puzzle that I'm missing,
I just need to find it.
Any help at all would be appreciated.
- James
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden