• 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
Notifications and Subclassing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Notifications and Subclassing


  • Subject: Notifications and Subclassing
  • From: Gordon Apple <email@hidden>
  • Date: Tue, 08 Mar 2011 09:42:38 -0600
  • Thread-topic: Notifications and Subclassing

Class A:  NSObject, has methods:

-  (void)foo:(Notification*)notification {
    ...
}

- (void)addObservers {
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(foo:)
                                                 name:notificationName
                                               object:nil];
}


Class B: subclass of A.  This is the class used.

Notification sent from elsewhere.  Console:

-[NSCFString foo:]: unrecognized selector sent to instance 0x69807c0


Is this due to confusion of of which class received the notification?  Or is
this a compiler/linker bug?  I even tried declaring foo in A¹s headers, to
no avail.  This same overall procedure is used elsewhere (without
subclassing), with no problems.  What am I missing?




_______________________________________________

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: Notifications and Subclassing
      • From: glenn andreas <email@hidden>
  • Prev by Date: Why do I have to initialize NSError ?
  • Next by Date: Re: Notifications and Subclassing
  • Previous by thread: Re: Why do I have to initialize NSError ?
  • Next by thread: Re: Notifications and Subclassing
  • Index(es):
    • Date
    • Thread