JMD
JMD

Reputation: 1590

Notification Observer is not catching the post

I have a split view controller, and the child masterView is attempting to send out a post notification under certain conditions in the 'viewDidAppear' method. However, the Observer that is located in the parent isn't ever being triggered.

Here is the observer code, implemented inside the viewDidLoad:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(customerSearchStatusIsSelected:) name:@"CUSTOMER_ORDER_DID_CHANGE_NOTIFICATION" object:nil];

and this is the post I have in the child masterView's viewDidAppear:

[[NSNotificationCenter defaultCenter] postNotificationName:@"CUSTOMER_ORDER_DID_CHANGE_NOTIFICATION" object:nil userInfo:[NSDictionary dictionaryWithObject:_tableData forKey:@"data"]];

this is my selector method header

-(void)customerSearchStatusIsSelected:(NSNotification *)data
{
   //some code
}

The childMasterView definitely sends out the post, but the selector I want the observer to call never gets called. What exactly am I missing here?

Upvotes: 0

Views: 1058

Answers (1)

JMD
JMD

Reputation: 1590

solution: needed to move the observer from viewDidLoad to viewDidAppear ... for whatever reason...

Upvotes: 2

Related Questions