title: IOS opening other view controller on buttonclick not working with storyboards
body: <p>I am having a silly problem with opening another viewcontroller on a buttonclick.</p>
  
  <p>On my viewcontroller on my storyboard, I have a button. When a users clicks on this button, a new viewcontroller should be opened. As far as I know, there are 2 ways to do this. </p>
  
  <ul>
  <li>in code</li>
  <li>on the storyboard itself</li>
  </ul>
  
  <p>Both methods are not working for me.
  First the problem with storyboards: </p>
  
  <p><a href="https://i.stack.imgur.com/19vc2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/19vc2.png" alt="enter image description here"></a><br>
  <sub>(source: <a href="https://gk3fag.bn1.livefilestore.com/y2pasvLnATS_KNdDRIJf5MtReTGt7vM_LC7gYmz20VFLQV10AtaIkWVf4D6FaPqR6fZTjGN_ojtS8fn5YoqfexnS98h4ek8lxkoq1vA0dxebOk/Schermafbeelding%202013-11-14%20om%2010.24.53.png" rel="nofollow noreferrer">livefilestore.com</a>)</sub>  </p>
  
  <p>I have connected my mainViewController with a navigationController, and I have connected my button with my next view (for adding an item). However, when I run the program, I get the following error:</p>
  
  <pre><code>'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
  </code></pre>
  
  <p>I really don't understand this error, because the mainviewcontroller IS managed by a UINavigationController.
  So, as this didn't work, I tried to handle it in code. I connected the buttonclick action to the mainViewController.h file and implemented it in the .m file. </p>
  
  <p>This is the action method when a user clicks on the button:</p>
  
  <pre><code>- (IBAction)actionBtnAdd:(id)sender {
      AddInventoryViewController *addinvController = [self.storyboard instantiateViewControllerWithIdentifier:@"AddInventoryViewController"];
      [self presentViewController:addinvController animated:NO completion:nil];
  }
  </code></pre>
  
  <p>The other viewcontroller is in the same storyboard, and the ID of the other viewcontroller is "AddInventoryViewController". This gives me the following error: </p>
  
  <pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
  </code></pre>
  
  <p>Anybody who know the problem? What would be the best approach to solve this?</p>