If the delegate of the split view manager has been replaced by the detail view controller, this causes a failure. The substituted detail view controller is deallocode and therefore the delegate of the split view controller is no longer a reference to a valid object.
You can update the delegate in the prepareForSegue: sender: file. For example:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"MySegue"]) { UIViewController *destinationViewController = [segue destinationViewController]; if ([destinationViewController conformsToProtocol:@protocol(UISplitViewControllerDelegate)]) { self.splitViewController.delegate = destinationViewController; } else { self.splitViewController.delegate = nil; } } }
Which view controllers you use for delegates depend on your view manager hierarchy. In the simplest case, any view controllers that are assigned to splitVC parts should probably be delegates. You might want to base them on a common superclass that handles the delegation logic of a split view controller.
Chris miles
source share