I am building a Universal iOS app. I have several buttons on the main view which load other view controllers. I have set up a "Main.storyboard" and an "iPad storyboard.storyboard". I have made two views in the "main" and the "iPad". On the "Main" I have set the Storyboard ID's to "FirstCar" and FirstPlayer". On the "iPad" I have set them to "FirstCarPad" and FirstPlayerPad". In the General settings I have designated the app as Universal and set the "Main" as the storyboard for the iPhone and the "iPad" for the iPad.
I am using the following code to launch the view controllers in the storyboards from the initial view.
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
int height = [UIScreen mainScreen].bounds.size.height;
if (height == 568.0) {
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"FirstCar"];
[self presentViewController:vc animated:YES completion:NULL]; }
}
else if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad){
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"ipad storyboard" bundle:nil];
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"FirstCarPad"];
[self presentViewController:vc animated:YES completion:NULL]; }
When I tap the first button that accesses the "FirstCar" and "FirstCarPad" ViewControllers everything works fine but When I tap the second button that accesses the "FirstPlayer" and "FirstPlayerPad" viewControllers the app crashes with this
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a view controller with identifier 'FirstPlayerPad''
but I have the viewControllers set up the exact same with the Storyboard ID
I am about to tear my hair out.
Can anybody help me out.