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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to