title: Call Selector method from another Class - NSNotificationCenter
body: <p>I would like to know how I can call the selector which is in another class when notification is posted.I am on tabbarcontroller.</p>
  
  <p>The <code>FirstViewController</code>, <code>SecondViewController</code> are <strong>tab bar items</strong></p>
  
  <pre><code>Inside `FirstViewController` I have the following
  
  -(void)viewdidload
  {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productPurchased:)   name:kProductPurchasedNotification object:nil];
  
    [[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(productPurchaseFailed:) name:kProductPurchaseFailedNotification object: nil];
  
  }
  
  - (void)productPurchased:(NSNotification *)notification {
  
      [NSObject cancelPreviousPerformRequestsWithTarget:self];
  
      NSString *productIdentifier = (NSString *) notification.object;
      NSLog(@"Purchased: %@", productIdentifier);
  
      [appDelegate.myDownloadablePoemsArray addObject:productIdentifier];
      [self.tabBarController setSelectedIndex:3];
  }
  
  - (void)productPurchaseFailed:(NSNotification *)notification {
  
      [NSObject cancelPreviousPerformRequestsWithTarget:self];
  
      SKPaymentTransaction * transaction = (SKPaymentTransaction *) notification.object;    
      if (transaction.error.code != SKErrorPaymentCancelled) {    
          UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Error!" 
                                                           message:transaction.error.localizedDescription 
                                                          delegate:nil 
                                                 cancelButtonTitle:nil 
                                                 otherButtonTitles:@"OK", nil] autorelease];
  
          [alert show];
      }
  
  }
  </code></pre>
  
  <p>The above code is working fine. Now what the issue is, I want to call the same selector method from my another view say for example I have a view controller named <code>SecondViewController</code>, in that I am adding the same notification observer.</p>
  
  <p>but the selector method is not called in the <code>FirstViewController</code>.</p>
  
  <p>Inside <code>SecondViewController</code> I have the following</p>
  
  <pre><code>-(void)viewdidload
  {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productPurchased:)   name:kProductPurchasedNotification object:nil];
  
    [[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(productPurchaseFailed:) name:kProductPurchaseFailedNotification object: nil];
  
  }
  </code></pre>
  
  <p>But I want to call the selecor methods from <code>FirstViewController</code>;</p>
  
  <p>Please let me know , is that possible ? And how can I do that?</p>
  
  <p>Thanks a lot</p>