Problem with versionForClassName
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