UIPageViewController NSInternalInconsistencyException

后端 未结 5 1951
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-20 17:51

I\'m developing a simple UIPageViewController that has two pages. Each page is loaded from a different ViewController with their specific xib

相关标签:
5条回答
  • 2021-02-20 18:03

    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.

    0 讨论(0)
  • 2021-02-20 18:08

    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)
    
    0 讨论(0)
  • 2021-02-20 18:12

    I fix this crash with changing direction .forward, to .reverse

    pageViewController?.setViewControllers([viewController], direction: direction, animated: true)
    
    0 讨论(0)
  • 2021-02-20 18:16

    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)
    
    0 讨论(0)
  • 2021-02-20 18:23

    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.

    0 讨论(0)
提交回复
热议问题