• 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
Unarchive consistency errors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unarchive consistency errors


  • Subject: Unarchive consistency errors
  • From: Sam Thorne <email@hidden>
  • Date: Sun, 25 Apr 2004 15:27:41 +0100

Hello,

I can't work out what the inconsistency might be in unarchiving.
My object inherits from NSObject so doesn't need to call [super initWithCoder:], the objects are encoded and decoded in the same order, why is this raising an inconsistency in unarchiving exception?

-(void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:myType]; // NSString
[coder encodeObject:name]; // NSString
[coder encodeObject:myPath]; // NSString
[coder encodeObject:codeView]; // NSMutableArray
[coder encodeObject:imagePreview]; // NSImage
[coder encodeObject:soundPreview]; // NSSound
}

-(id)initWithCoder:(NSCoder *)coder
{
if (self = [super init]){
[self setMyType:[coder decodeObject]];
[self setName:[coder decodeObject]];
[self setMyPath:[coder decodeObject]];
[self setCodeView:[coder decodeObject]];
[self setImagePreview:[coder decodeObject]];
[self setSoundPreview:[coder decodeObject]];
}

return self;

}

The only different from normal mutator I have is this:
-(void)setMyType:(NSString *)setType
{
id old = myType;
myType = [setType retain];
[old release];
if ([myType isEqualToString:@"code"]){
myIcon = [[NSImage imageNamed:@"codeIcon"] retain];
}else if([myType isEqualToString:@"graphic"]){
myIcon = [[NSImage imageNamed:@"image"] retain];
}else if([myType isEqualToString:@"sound"]){
myIcon = [[NSImage imageNamed:@"volume"] retain];
}
}
with an accessor that just returns myIcon.

Any clues?

Thanks!
--
Sam

So long, and thanks for all the fish.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Unarchive consistency errors
      • From: Prachi Gauriar <email@hidden>
  • Prev by Date: Getting the scroll position
  • Next by Date: Resolving aliases in a path
  • Previous by thread: Re: Getting the scroll position
  • Next by thread: Re: Unarchive consistency errors
  • Index(es):
    • Date
    • Thread