I am pretty sure this question has been asked and answered, but I am not sure what I am doing wrong that I am not being able to get the method called from NSNotificationCenter. I have two classes : Sign In Class And Calendar View Class I want to pass single user credential from SignIn to Calendar. I have put the Calendar in SWRevealController. NSNotification is being called but the trigger method is not called for some reason.
Sign In
- (IBAction)signIn:(id)sender {
_passWord = _password.text;
NSLog(@"%@ %@",_userName,_passWord);
[[NSNotificationCenter defaultCenter] postNotificationName: @"Password" object: _passWord];
[self performSegueWithIdentifier:@"signIn" sender:self];
}
Calendar
- (void)viewDidLoad {
[super viewDidLoad];
UIImage *ppnImage = [UIImage imageNamed:@"PPNImage.png"];
NSLog(@"came here");
[[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(triggerAction:) name:@"Password" object:nil];
SWRevealViewController *revealViewController = self.revealViewController;
if ( revealViewController )
{
[self.sidebarButton setTarget: self.revealViewController];
[self.sidebarButton setAction: @selector( revealToggle: )];
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
}
events = [[NSMutableArray alloc]init];
[_indicator startAnimating];
self.tableView.delegate = self;
//Creating a background queue
web = [WebRequests sharedInstance];
web.delegate = self;
[web loginView];
}
-(void) triggerAction: (NSNotification *) notification {
NSLog(@"Does not call this");
}
Here
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(triggerAction:) name:@"Password" object:nil];
is called BUT the below method is not called
-(void) triggerAction: (NSNotification *) notification
{
NSLog(@"Does not call this");
}
Really appreciate if somebody can suggest me what am I doing wrong