0

I'm trying to recreate a small iOS app that utilized nib files. I'm trying to replace the following line of code

 self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];

with:

UIStoryboard*  sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController* viewController = [sb instantiateViewControllerWithIdentifier:@"viewController"];    self.window.rootViewController = self.    viewController;

I'm getting the following error: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a view controller with identifier 'viewController''

I got the latter code from a previous Stack Overflow question on a similar topic. Can someone please advise on what the issue I'm having is and how to proceed?

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

1

You need to name the view controller in your storyboard by giving it a storyboard id. I typically try to use something memorable like the name of the view controllers class so I don't have to look it up.enter image description here

Brandon
  • 2,387
  • 13
  • 25
  • Hi - I think that resolved the issue (I say I think bc I'm currently debugging something else that popped up). Thanks! – user3525783 May 08 '14 at 00:19