I am using NSNotification to pass value between ViewControllers, but value is not getting passed and when i used breakpoints to check what's going wrong i came to know that the receive notification selector method is not called. Following is the code what i have written
AViewController.m
[[NSNotificationCenter defaultCenter] postNotificationName:@"speciality" object:nil userInfo:[specialityIdArray objectAtIndex:indexPath.row]];
BViewCOntroller.m
-(void)viewWillAppear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveSpecialityId:) name:@"speciality" object:nil];
}
-(void)receiveSpecialityId:(NSNotification *)notificaton
{
NSString *selectedServiceString=[[notificaton userInfo] valueForKey:@"service"];
_specialtiyId = selectedServiceString;
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"service" object:nil ];
}
I am trying to pass value from AViewController to BViewController
I have read all the discussions done previously on this same issue, but none of them solved my issue