In my app I use UIPageViewController
(PVC) with UIPageViewControllerTransitionStylePageCurl
transition style and UIPageViewControllerSpineLocationMid
spin location. So PVC shows two pages at a time.
I experience a rare crash when I try to scroll past the last pages. The log says:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The number of view controllers provided (0) doesn't match the number required (2) for the requested transition'.
I thought I did something wrong and tried to play around with Apple demo project (https://developer.apple.com/library/ios/samplecode/ZoomingPDFViewer/Introduction/Intro.html).
And the crash happened there too. It's hard to reproduce, you should scroll almost perpendicular to normal scroll axis (vertically).
My guess is that dataSource
's methods got called in wrong order and messed PVC's integrity.
I got this order of calls:
2016-08-19 15:03:52.905 ZoomingPDFViewer[7469:1878917] next controller: nil
2016-08-19 15:03:53.358 ZoomingPDFViewer[7469:1878917] prev controller: <DataViewController: 0x14dd5b990>
2016-08-19 15:03:53.358 ZoomingPDFViewer[7469:1878917] prev controller: <DataViewController: 0x14dd42a50>
2016-08-19 15:03:53.373 ZoomingPDFViewer[7469:1878917] next controller: nil
So it seems PVC kind of wants to scroll and back and forth at the same time.
My question is there any way to workaround this problem? I can't think of any right now as dataSource
's methods return correct data (so it seems).