Hi,
In my iPad app, in one class I register for a notification:
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(selectedList:) name:@"TTSelectedList" object:nil];
My selectedList:
method looks like this:
- (void)selectedList:(NSNotification*)notification
{
NSLog(@"received notification");
}
Then in another class (a UITableViewController
) I post that notification when a row is selected:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"posting notification");
[[NSNotificationCenter defaultCenter] postNotificationName:@"TTSelectedList" object:nil];
}
I can confirm that the notification is being posted, because "posting notification" is logged to the console, but "received notification" is never called, meaning that the notification isn't received and the selector hasn't been called. I can't figure out what's causing this.
Thanks