The iPad version of an app of mine uses a UISplitViewController on which I load UINavigationControllers on both view controllers. Upon some events both view controllers get new controllers pushed and popped. When I use the app in landscape everything works fine, while when I use it in portrait I get:
Unbalanced calls to begin/end appearance transitions for iPuja.MonastersAndCentersTableViewController: 0x18d7b020. notwithstanding everything seems to work fine, apart of the error.
That is how I pop the master controller from the detail one (Swift):
@IBAction func dismiss(sender: AnyObject) {
self.navigationController?.popViewControllerAnimated(true)
(self.splitViewController?.viewControllers[0] as? UINavigationController)?.popViewControllerAnimated(true)
}
and this how I push it (objective-c):
if([[[UIDevice currentDevice] model] isEqualToString:@"iPad"]){
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"StoryboardiPad" bundle: nil];
UIViewController *controller = [mainStoryboard instantiateViewControllerWithIdentifier: @"editCenters"];
[self.splitViewController.viewControllers[0] pushViewController:controller animated:YES];
}
If I skip popping the master controller I get no error, but of course the master detail is not popped up when I display it.
Funnily, if I briefly display the master controller in Portrait by dragging it, the error is not presented any longer, until I rotate it to landscape and rotate it again to portrait.
I managed the issue by delaying the operations on the master controller to when it is shown. The code is a little less elegant, but the warning is gone.