Archiving problem with subclass of NSCalendarDate
Archiving problem with subclass of NSCalendarDate
- Subject: Archiving problem with subclass of NSCalendarDate
- From: email@hidden
- Date: Wed, 23 Jan 2002 01:50:58 +0900
hello,
I'm trying to make lunar calendar.
So, I made LunarDate class, subclass of NSCalendarDate. and added some
instance variables, methods...for lunar.
everything works fine except Archiving and Unarchiving. I tried and
tried to solve this problem, but couldn't.
How can I Archive subclass of NSCalendarDate?
this is my sample code for archiving..
@interface LunarDate : NSCalendarDate <NSCoding>{
NSString *str;
BOOL isLeap;
.
.
}
@implementation LunarDate
-(id)initWithCoder:(NSCoder*)coder
{
if(self=[super initWithCoder:coder])
{
[self setStr:[coder decodeObject]];
}
return self;
}
-(void)encodeWithCoder:(NSCoder*)coder
{
[super encodeWithCoder:coder];
[coder encodeObject:str];
}
when I subclass NSObject,(After deleting if(self=....),[super ....])
,this code works fine..but whenever I subclass NSCalendarDate , and
Unarchive it,
*** NSUnarchiver: inconsistency between written and read data for object
0x1433f0 Error occured.
how can I Archive the subclass of NSCalendarDate?..
and..sorry poor my English :-<