• 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
Problem with versionForClassName
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with versionForClassName


  • Subject: Problem with versionForClassName
  • From: Miguel Arroz <email@hidden>
  • Date: Fri, 21 Jan 2005 01:13:53 +0000

Hi!

I'm testing the versioning stuff of NSObject and keyed coder. I have this code:

+ (void) initialize {
	[self setVersion:SOME_VERSION];
}

- (id)initWithCoder:(NSCoder *)coder
{
NSLog(@"Version: %d", [coder versionForClassName:@"CSCard"]);

if ( [coder allowsKeyedCoding] ) {
// Can decode keys in any order
name = [[coder decodeObjectForKey:@"CSCardName"] retain];
description = [[coder decodeObjectForKey:@"CSCardDescription"] retain];

} else {
NSException *exception = [NSException exceptionWithName:@"encodingException"
reason:@"Cannot decode data with non-keyed decode" userInfo:nil];
@throw exception;
}

return self;
}


- (void)encodeWithCoder:(NSCoder *)coder
{
if ( [coder allowsKeyedCoding] ) {
[coder encodeObject:name forKey:@"CSCardName"];
[coder encodeObject:description forKey:@"CSCardDescription"];
} else {
NSException *exception = [NSException exceptionWithName:@"encodingException"
reason:@"Cannot encode data with non-keyed encoder" userInfo:nil];
@throw exception;
}

return;
}


OK. Now, the problem is that the NSLog always prints the actual version of the class, and not the version used to archieve the class. I'm probably doing something wrong, but... WHERE?

  Yours

Miguel Arroz


"I felt like putting a bullet between the eyes of every Panda that wouldn't scr*w to save its species." -- Fight Club

  Miguel Arroz - email@hidden - http://guiamac.com/bagos

_______________________________________________
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


  • Prev by Date: Basic Array Access Strategy
  • Next by Date: Cocoa global hotkey
  • Previous by thread: Re: Basic Array Access Strategy
  • Next by thread: Cocoa global hotkey
  • Index(es):
    • Date
    • Thread