• 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
Newbie query re notifications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie query re notifications


  • Subject: Newbie query re notifications
  • From: "McLaughlin, Michael P." <email@hidden>
  • Date: Fri, 6 Mar 2009 11:18:56 -0500
  • Acceptlanguage: en-US
  • Thread-topic: Newbie query re notifications

I have been using notifications in a simple document app that processes data
from a datafile.  This app has a document window and an appDelegate, both of
which appear in IB with the proper connections.  The document can
successfully send notifications to the appDelegate and the latter can send
notifications to itself. All of this is OK.

Today, I realized that I should have a separate class for some of the data
processing.  This separate class, SatManager, has no GUI elements and does
not appear in IB in any way.  Its implementation includes

- (id)init
{
   self = [super init];
   if (self) {
      NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
      [nc addObserver:self selector:@selector(getGPS) name:@"fetchGPS"
object:nil];
   }
   return self;
}

The appDelegate includes

- (void)initCase
{
...
  [[NSNotificationQueue defaultQueue] enqueueNotification: [NSNotification
notificationWithName:@"fetchGPS"
object:nil] postingStyle:NSPostWhenIdle];
}

This enqueueing worked fine when getGPS() was a method of appDelegate but
not now when getGPS() is a method of SatManager.  Now, the notification does
not reach getGPS() even though the SatManager addObserver() call gave no
errors.

Am I oversimplifying something?  Do I need to do more to pass notifications
around -- like add something in IB, perhaps?

TIA.

--
Mike McLaughlin

_______________________________________________

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: Newbie query re notifications
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: A question about NSPredicateEditor and NSPredicateEditorRowTemplate
  • Next by Date: Supported platforms?
  • Previous by thread: Re: A question about NSPredicateEditor and NSPredicateEditorRowTemplate
  • Next by thread: Re: Newbie query re notifications
  • Index(es):
    • Date
    • Thread