Re: NSKeyedArchiver exception
Re: NSKeyedArchiver exception
- Subject: Re: NSKeyedArchiver exception
- From: Will Mason <email@hidden>
- Date: Mon, 19 Sep 2005 17:17:13 -0700 (PDT)
Hi, Ken,
You're not doing anything wrong. If you look at the declaration of NSPrintInfo, you'll see:
@interface NSPrintInfo : NSObject<NSCopying, NSCoding> {
@private
NSMutableDictionary *_attributes;
void *_moreVars;
}
It's a pretty safe bet to guess that _moreVars is an instance of a private structure. The fact that NSKeyedArchiver won't encode structs also means that it won't encode NSPrintInfo instances either. This is not particularly surprising, as the Next runtime's lack of support for determining the exact layout of a struct makes the task amazingly tedious. Believe me, I've done it. The GNU runtime, on the other hand, is great for this. :) In your case, though, it's difficult to suggest an alternative other than avoiding trying to archive instances of NSPrintInfo.
Sorry I can't be more helpful,
Will
----- Original Message ----
i've narrowed a problem i'm getting to the following 3 lines of code:
NSMutableDictionary* piDict = [[myDoc printInfo] dictionary];
NSPrintInfo* newPI = [[NSPrintInfo alloc] initWithDictionary: piDict];
NSData* pd = [NSKeyedArchiver archivedDataWithRootObject: newPI];
the third line throws the following exception:
*** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this
archiver cannot encode structs
i've searched the archives and didn't find anything that would explain this.
what am i doing wrong?
_______________________________________________
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