Assertion failure in UIPageViewController
So my solution to this was adding a BOOL
which keeps track of my animations state. So before setting the new ViewController
, I modify this too:
if (!_transitionInProgress) {
_transitionInProgress = YES;
[self.pageController setViewControllers:@[viewController] direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:^(BOOL finished) {
_transitionInProgress = !finished;
}];
}
So I'll wait for my animation to finish before setting a new view controller. In my case, I have a some buttons the user can press in order to switch pages. This also prevents them from going too fast through them so the animations are always smooth and nice
This is a bug in the internal implementation of UIPageViewController in scroll mode. It happens when a transition animation occurs while the page view controller is already animating a transition. What I ended up doing was to block the UI from allowing multiple quick scrolls. I have two buttons, left and right, which make the page view controller scroll to previous or next page controller. I disable the buttons' operation while there is an animation going. The page view controller's delegate tells you all you need to know when to disable the UI's functionality and when to re-enable it, once all animations have stopped.