1
votes

I have problem when i try to lunch my app in my IPad 6.0 Simulator i got every time the same problem *Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'UISplitViewController is only supported when running under UIUserInterfaceIdiomPad' *

and i really dont know why

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ UISplitViewController spvc = (UISplitViewController) self.window.rootViewController; spvc.delegate = [spvc.viewControllers lastObject]; } return YES; }

How can here be an error / or where

- (void) :(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc {

barButtonItem.title = @"Master";
NSMutableArray *items = [[self.toolbar items]mutableCopy];
[items insertObject:barButtonItem atIndex:0];
[self.toolbar setItems:items animated:YES];
self.masterPopOverController = pc;}


-(void) splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem{

NSMutableArray *items = [[self.toolbar items]mutableCopy];
[items insertObject:barButtonItem atIndex:0];
[self.toolbar setItems:items animated:YES];
self.masterPopOverController = nil;}

Thanks for help and fast answers

3
Is it a Universal application ?Evol Gate

3 Answers

2
votes

From the XCode project navigator...

  1. click on your project
  2. click on your app name located under "Targets"
  3. click the "Summary" tab on the top right
  4. look at the section labeled "iPhone/iPod Deployment Info" and find "Main Storyboard" If the Main Storyboard says something like "MainStoryboard_iPad" in the list box THIS IS THE PROBLEM.

To fix it, change it to the iPhone version of your storyboard. (e.g "MainStoryboard_iPhone")

Why?

When you create a Universal app, it creates deployment info for both the iPhone AND the iPad. If your are running into this error you probably have configured the target deployment to use the wrong story board. Since the simulator thinks it is an iPhone it uses the iPhone deployment, but the problem is that the iPhone deployment says use the iPad storyboard to initialize, and the iPad storyboard contains a UISplitViewController which CANNOT run on iPhone - thus the error.

1
votes

UISplitViewController is a component only made for iPad and not for iPhone.

Since your application is a Universal application, therefore the condition that you are talking about (the "UIUserInterfaceIdiomPad" one) checks whether the device is iPad or iPhone. Therefore it is must.

0
votes

There is no way you can achieve this using the UISplitViewController class. If you take a look at the Apple reference documents it clearly states that the UISplitViewController is an iPad-specific viewcontroller.