I am using a UISplitViewController on ARC.
I setup the controller in my AppDelegate, then make it the rootViewController. I have made sure to make it a property:
@property (strong, nonatomic) UISplitViewController *splitViewController;
Setting the root and detail using the viewControllers property works fine when first creating. And it works fine again when setting a second time, but I get a crash on the third time I try setting the viewControllers property.
Here is how I set those:
Screens *edit = [[Screens alloc] initWithStyle:UITableViewStyleGrouped];
UINavigationController *c = [[UINavigationController alloc] initWithRootViewController:edit];
if ([Utility isIpad]) {
Map *a = (Map *)[[MyAppDelegate instance].splitViewController.viewControllers objectAtIndex:0];
NSArray *viewControllers = [NSArray arrayWithObjects:a, c, nil];
UISplitViewController *splitView = [MyAppDelegate instance].splitViewController;
splitView.viewControllers = viewControllers;// <--- Crashes here
} else {
[self presentModalViewController:c animated:YES];
}//end
Why would it crash when I try to set the viewControllers property? It almost seems like it is released, but I know that the splitViewController is still there…
Could this be something to do with ARC?
Stacktrace:

I had the same error just now. In my case the problem was that I had originally set up the detail view controller to be a delegate of the
UISplitViewController. Then I refactored to make the root view controller handle things, but I forgot to remove the connection from the.xibfile.So, when I set
splitView.viewControllersthe first time everything worked, but then my original detail controller would get released and theUISplitViewControllerwas left with a bad pointer asdelegate. The next time I set theviewControllersproperty, theUISplitViewControllertried to call its delegate through the pointer and crashed.You write that you set up the controller in your app delegate, so this may not be exactly the same problem you had. Still, double check to make sure the
delegateproperty of theUISplitViewControlleris set correctly!