Reputation: 537
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
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
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
Reputation: 12908
Two questions:
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
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
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