I\'m developing a simple UIPageViewController
that has two pages. Each page is loaded from a different ViewController
with their specific xib
In my case, this happened when I tried to navigate to the next page view controller inside another view controller that was presented as a modal.
Hopefully this helps other people.
Figured it out (at least what my problem was) - You shouldn't set a UIViewController's self.view directly, but instead use self.view.addSubview(viewA) and then use
UIView.transitionFromView(self.viewA, toView: self.viewB, duration: 0.5, options: UIViewAnimationOptions.TransitionFlipFromLeft, completion: nil)
I fix this crash with changing direction .forward, to .reverse
pageViewController?.setViewControllers([viewController], direction: direction, animated: true)
I was having one 'UIPageViewController' in Storyboard and from one of the pages, I was trying to present new 'UINavigationController' with attached 'Rootviewcontroller' which was in separate xib.
When I removed xib and put this view controller as stand alone in storyboard it worked like a charm.
So I think the catch is that if both the container view are in same storyboard then it is not giving any exception or error.
let listView = String(describing: ListViewController.self)
let listViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: listView)
let navigationController = UINavigationController(rootViewController: listViewController)
self.present(navigationController, animated: true, completion: nil)
I happened to stumble upon the same error when using the following argument passed on launch:
-UIViewShowAlignmentRects YES
After wasting 2 days trying to find error within my UIPageViewController, it turned out that after disabling XCode generated yellow rectangle wrappers, the NSInternalConsistencyException evaporated.