views:

51

answers:

2

Hey there, so I've got an NSObject subclass sending out a message via the notification center, and I'm sending out my notifications out to the object nil but the only object that can receive notifications is the one sending them

I've got two notifications being sent out at the same time (to test if it is a threading issue)

[[NSNotificationCenter defaultCenter] postNotificationName:kWGAskingForAuthToken object:nil];

int status = 123;
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"RAR" forKey:@"Status"];
NSNotification *note = [NSNotification notificationWithName:kWGAskingForAuthToken  object:nil userInfo:userInfo];
[[NSNotificationCenter defaultCenter] performSelectorOnMainThread:@selector(postNotification:) withObject:note waitUntilDone:YES];

and my observers are just as simple

[[NSNotificationCenter defaultCenter]  addObserver:self selector:@selector(handleMyEvent:)name:kWGAskingForAuthToken object:nil]; 

it's the same observer in a separate object which doesnt recieve the notification

A: 

This looks like the proper way to me. The only question is "where is kWGAskingForAuthToken defined?" Is it possible it's defined in more than one place? Possibly differently?

Joshua Nozzi
I'm afraid it is defined properly ( as an NSString constant they both have included )What makes it kinda frustrating is that I have a log of all notifications going through the center which echos out hundreds but never my own( [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(log:) name:nil object:nil]; )
orta
A: 

It's a shame but I never managed to find an answer to this, instead I just started sending messages to objects instead of using them globally.

orta