Keyed encoding
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