• 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
Keyed encoding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Keyed encoding


  • Subject: Keyed encoding
  • From: Andy Bettis <email@hidden>
  • Date: Tue, 21 Jun 2005 16:57:00 +0100

Hi,

I've got to the point of saving and loading with my app, and a problem has occurred.

My strategy is in my document's dataRepresentationOfType I create a temporary NSMutableDictionary object , add the top-level objects to this, then call [NSArchiver archivedDataWithRootObject:theDict] and return the result. The objects I'm adding at present are NSMutableArray objects, although there will be more later.

The arrays contain custom class objects. For each of these I have defined initWithCoder methods that use encodeObject:forKey, encodeBool:forKey, etc. calls to archive their data members. The calls to encodeObject:forKey only pass built-in class objects (NSString, NSNumber, NSCalendarDate).

When I save the data I get the message:

-encodeObject:forKey: only defined for abstract class. Define - [NSArchiver encodeObject:forKey:]!

I'm not sure where I need to define this. The arrays are encoded with keys but I assumed I could leave the NSMutableArray class to take care of itself, and just have to encode/decode the objects held in them. What else do I need to do?

Many thanks,

Rev. Andy
_______________________________________________
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: Keyed encoding
      • From: Will Mason <email@hidden>
  • Prev by Date: Re: NSFileManager - getting list of "safe" files/folders [update]
  • Next by Date: Re: Open Recent menus
  • Previous by thread: Re: Another bug in Cocoa text system
  • Next by thread: Re: Keyed encoding
  • Index(es):
    • Date
    • Thread