title: Objective C - Access Method befor changing View Controller
body: <p>I'm trying to call a method before I change the ViewController. Here's my Code:</p>
  
  <p>ViewController.m (First View, here I want to set a String)</p>
  
  <pre><code>-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
      if([segue.identifier isEqualToString:@"loginCorrect"]){
         [segue.destinationViewController setMail:@"asd"];
      }
  }
  </code></pre>
  
  <p>ViewControllerMainMenu.h</p>
  
  <pre><code>- (void)setMail:(NSString*)mail;
  @property (strong) NSString *userMail;
  </code></pre>
  
  <p>ViewControllerMainMenu.m</p>
  
  <pre><code>- (void)setMail:(NSString*)mail
  {
      self.userMail = mail;
  }
  </code></pre>
  
  <p>As you can see, I want to use the userMail String in the second View, which I get in the first View (a classic Login should be the result).</p>
  
  <p>But I always become this Error:</p>
  
  <pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarController setMail:]: unrecognized selector sent to instance 0x147635080'
  </code></pre>
  
  <p>Hope you can help me, Thanks!
  Emanuel</p>