• 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
encoding/decoding selectors?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: encoding/decoding selectors?
      • From: Andy Lee <email@hidden>
    • Re: encoding/decoding selectors?
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Katoeri-Hiragana input underline drawing
  • Next by Date: Re: encoding/decoding selectors?
  • Previous by thread: Katoeri-Hiragana input underline drawing
  • Next by thread: Re: encoding/decoding selectors?
  • Index(es):
    • Date
    • Thread