title: Application tried to present modally an active controller ios
body: <p>I was trying to set the ViewController with a parent view controller before it shows show that it can provide call backs, I done this using <code>PrepareForSegue</code></p>
  
  <pre><code>- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
      if ([segue.identifier isEqualToString:@"newQuarter"])
      {
          [segue.destinationViewController setParentViewController:self];
      }
  }
  </code></pre>
  
  <p>It crashed giving me the error message: <code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller.</code></p>
  
  <p>So I tried using another method and set up a new view controller on the button touches up,</p>
  
  <pre><code>- (IBAction) buttonClicked
  {
      NewViewController *newController = [[NewViewController alloc] init];
      [newController setParentViewController:self];
  
      [self presentViewController:newController animated:YES completion:nil];
  }
  </code></pre>
  
  <p>but with no luck it is still giving me the same error message, can anyone please advice? Thanks!</p>