• 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
Using performSelector: on super
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using performSelector: on super


  • Subject: Using performSelector: on super
  • From: "email@hidden" <email@hidden>
  • Date: Tue, 5 Aug 2008 13:41:18 +0100

Hello list

My superclass (SuperSocket) provides a private method -close.
My subclass overrides this private method as follows:

- (void)close
{
	SEL closeSelector = @selector(close);

	if ([SuperSocket instancesRespondToSelector:closeSelector]) {
		[super performSelector:closeSelector];	// seems to send to self
	} else {
		NSAssert (NO, @"SuperSocket no longer responds to close message.");
	}

	// subclass additional code
}

If I am not mistaken this code appears to send the close selector to the self object.
If [super performSelector:closeSelector] is replaced by [super close] then the super object receives the close message as expected.


I know that [super respondsToSelector: closeSelector] is equivalent to [self respondsToSelector: closeSelector] as the methods tests the object as a whole (see NSObject Protocol Reference entry for respondsToSelector;);
So is that the story here?
Or am I on the wrong page entirely.



_______________________________________________

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: Using performSelector: on super
      • From: "Michael Ash" <email@hidden>
    • Re: Using performSelector: on super
      • From: James Bucanek <email@hidden>
    • Re: Using performSelector: on super
      • From: "Clark Cox" <email@hidden>
  • Prev by Date: Re: Localize App Title?
  • Next by Date: Re: Automatic population of NSTableView with custom columns at launch time
  • Previous by thread: Re: Localize App Title?
  • Next by thread: Re: Using performSelector: on super
  • Index(es):
    • Date
    • Thread