0

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?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
JMD
  • 1,540
  • 2
  • 24
  • 56
  • Have you tried to move your notification registration code from `-viewDidLoad:` to `-init` method? – Lukas Kukacka May 17 '13 at 14:04
  • just tried that, no effect – JMD May 17 '13 at 14:06
  • ok, i moved the observer to the viewDidAppear method and that seemed to work. I have no idea what the difference would be.... – JMD May 17 '13 at 14:11
  • the setup and loading of the controller is not fully loaded to add a observer to a controller to it it must initialised – Radu May 17 '13 at 14:39

1 Answers1

2

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

JMD
  • 1,540
  • 2
  • 24
  • 56