Archiving / Unarchiving Question
Archiving / Unarchiving Question
- Subject: Archiving / Unarchiving Question
- From: "Tony S. Wu" <email@hidden>
- Date: Wed, 01 Jun 2011 18:23:20 -0700
Hi,
I've been beating my head against the monitor for the past 2 hours trying to figure this out. I would really appreciate it if someone can give me some guidelines.
I have a server - client application, and I need to archive an object so that I can send the data back and forth between the client and the server. Here is what the archiving methods in the object look like, property1 being a NSString:
- (void)encodeWithCoder:(NSCoder *)coder {
// [super encodeWithCoder:coder];
[coder encodeObject:property1 forKey:@"Property1"];
}
- (id)initWithCoder:(NSCoder *)coder {
//self = [super initWithCoder:coder];
self = [super init];
property1 = [[coder decodeObjectForKey:@"Property1"] retain];
return self;
}
My problem is that I can archive and unarchive this object just fine on the client, but once I send the data over the network to the server, attempting to unarchive the object then results in an exception being thrown. I tried to compare the byte and length of the data before and after sending it over the network, and they appears to be identical. I tried to send a simple archived NSArray, and it works fine. So I must've missed something really important in my code.
I would appreciate any help.
Thanks,
Tony S. Wu
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden