Re: not seeing NSNotification
Re: not seeing NSNotification
- Subject: Re: not seeing NSNotification
- From: Matt Neuburg <email@hidden>
- Date: Wed, 07 Jun 2006 15:47:55 -0700
- Thread-topic: not seeing NSNotification
On Wed, 7 Jun 2006 11:57:26 -0700, "Tyler Riddle" <email@hidden>
said:
>Hello again,
>
>I'm still having troubles with NSNotificationCenter - now my
>controller is not seeing an NSNotification being sent by my model. The
>model does the following:
>
>NSLog(@"sending notification");
>
>[[NSNotificationCenter defaultCenter]
>postNotificationName:@"MBModelStateChanged" object:self
>userInfo:info];
>
>and the run log has an entry for "sending notification" so I know my
>method is getting called. I register for the notification in my
>controller with:
>
>[[NSNotificationCenter defaultCenter] addObserver:self
>selector:@selector(modelStateChanged:) name:@"MBModelStateChanged"
>object:nil];
>
>and the contents of modelStateChanged: is
>
>- (void)modelStateChanged:(NSNotification *)notification
>{
> NSLog(@"model state changed");
> //NSDictionary* modelState = [notification userInfo];
> //NSLog([modelState description]);
>}
>
>"model state changed" never shows up in the run log. Even if I
>register with name:nil object:nil I still don't see the notification
>(but I do see quite a few others). I'm at a loss as to what is going
>on here. Can anyone give me some advice? Maybe I'm making another
>newbie mistake here?
>
>This is for an open-source project to create a new CDRW/DVD-RW/DVD+RW
>blanking utility. My notification is being sent in response to a
>notification from the disc recording notification center - maybe I'm
>stacking too many notifications on top of each other?
>
>Any help is greatly appreciated.
Tyler - This stuff is really hard to track down, because (as I have
complained here before) there is no way to ask the notification center what
objects it has registered for what notifications. The last time this
happened to me, it turned out that some other code was removing the observer
before the notification was ever posted. But I had a really hard time
finding that out. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden