hi guys,
here i am again:
what i want to do is: if i press a button, then post a notification. This notification should be cached by 2 instances of the same class.
the problem:
the notification is posted, but it is cached just by one instance.
some code and explanation
i have 1 tab bar controller
i have 3 tabs ( 3 different views -xib files-)
2 views references the same (view controller) class (so, there are 2 instances of the same class, let's say class A)
the other tab/view references another class (class B)
if i press a button of one view, a method of class B is fired and, at some point it does this:
[[NSNotificationCenter defaultCenter] postNotificationName:@"update" object:nil ];
in the viewDidLoad
method of class A I have this:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateAll:) name:@"update" object:nil];
also, i have defined the updateAll
function as:
- (void) updateAll: (NSNotification *) notification {
NSLog(@"called");
}
As i said before, just one time the updateAll
method is fired.
questions
why?
how to fix it?
thanks for reading!