Re: not seeing NSNotification
Re: not seeing NSNotification
- Subject: Re: not seeing NSNotification
- From: Paul Lynch <email@hidden>
- Date: Wed, 7 Jun 2006 22:17:09 +0100
The code you quote should work; therefore your problem is elsewhere.
I'd double check for spelling errors in the selector and notification
name first of all. Next, I'd set up a separate simple test app to
duplicate what I though was happening. From your description, it
would be most logical that the notification isn't really being sent,
and you need to verify that.
Paul
On 7 Jun 2006, at 19:57, Tyler Riddle wrote:
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 Riddle
_______________________________________________
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