marc
marc

Reputation: 537

StoryBoard can not find ViewController

I'm developing a small app just to learn iOS, and I'm stucked in a situation with the StoryBoard and a ViewController which apparently exists, but when I run the app the compiler throws me a NSInvalidArgumentException.

The error is the following one:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a view controller with identifier 'recivedPushViewController''

As you can see in the following picture, the StoryboardID has been set up

Identity Inspector

The code which calls the ViewController is the following:

        UIViewController* vc = [self.storyboard instantiateViewControllerWithIdentifier:@"recivedPushViewController"];
        vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
        [self presentViewController:vc animated:TRUE completion:NULL];

Can anyone help me??

Thank you so much

Upvotes: 0

Views: 4623

Answers (4)

marc
marc

Reputation: 537

Well ladies and gentleman... I've removed the app from iPhone Simulator,I've cleaned project and built it again,all this before run it. IT WORKS.

To be honest... I don't understand anything.

Thank you so much for wasting your time in my post.

Upvotes: 1

Vaibhav Saran
Vaibhav Saran

Reputation: 12908

Two questions:

  • Is this a universal app?
  • Does it have 2 StoryBoards?

Are you sure you are adding ViewController to both of the storyboards? It can be a silly mistake while you are adding VC to iPhone StoryBoard only and running iPad app or viceversa. 😝😝

Upvotes: 1

KerrM
KerrM

Reputation: 5240

Are you sure you're getting the right storyboard? Use:

 UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

To get the main storyboard

Upvotes: 0

Kathiravan G
Kathiravan G

Reputation: 487

You mapping your view controller class to RecivedPushViewController. Try This

RecivedPushViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"recivedPushViewController"];
                vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
                [self presentViewController:vc animated:TRUE completion:NULL];

Upvotes: 0

Related Questions