• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Class-Within-Class and Archiving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Class-Within-Class and Archiving


  • Subject: Class-Within-Class and Archiving
  • From: James Gifford <email@hidden>
  • Date: Mon, 5 Sep 2005 13:55:04 -0700

I am trying to figure out how to properly archive data involving a couple of custom classes.

I've made a custom class called "Book" and it contains a few simple NSString variables for title, author, publisher, and such. It also contains an array which is filled with another custom class called "Character." The "Character" custom class has simple NSString variables for name, age, role and so on. Before I added the array of "Character" objects to my "Book" class, I could simply use NSArchiver to save the data to a file. Now, with each "Book" object containing some "Character" objects, NSArchiver won't work. Both methods conform to NSCoding and separately they can be NSArchived just fine. But when one class contains objects of the other class, NSArchiving falls apart.

I am using an NSMutableArray of "Book" objects to serve as the datasource for an NSTableVIew. Getting all the data to display in the NSTableView works just fine, but I can't get the data to save.

My question is this: Is there a way (hopefully a simple one) to save my data in the manner in which I am currently organizing it? I've got an array of "Book" objects each of which contains some number of "Character" objects. I would like to just save the data in one file, but if two files are necessary, then so be it. Any ideas in the matter would be much appreciated.
_______________________________________________
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
  • Follow-Ups:
    • Re: Class-Within-Class and Archiving
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Single-click NSTableView edit
  • Next by Date: NSArrayController / NSTableView questions
  • Previous by thread: Single-click NSTableView edit
  • Next by thread: Re: Class-Within-Class and Archiving
  • Index(es):
    • Date
    • Thread