encoding/decoding selectors?
encoding/decoding selectors?
- Subject: encoding/decoding selectors?
- From: "Karan, Cem (Civ, ARL/CISD)" <email@hidden>
- Date: Mon, 15 Dec 2008 08:47:44 -0500
- Thread-topic: encoding/decoding selectors?
I need to encode/decode an object which has a selector as one of its instance variables. I know that NSCoder doesn't directly support this, so my current way of doing things is the following:
- (void) encodeWithCoder:(NSCoder *) aCoder
{
[aCoder encodeObject:NSStringFromSelector(self.selector) forKey:@"selector"];
}
- (id) initWithCoder:(NSCoder *)aDecoder
{
self.selector = NSSelectorFromString([aDecoder decodeObjectForKey:@"selector"]);
}
Is this the correct method?
Thanks,
Cem Karan
_______________________________________________
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