UIPageViewController: handling odd number of pages with spine location set to mid

When I use UIPageViewController with the Spine Location set to Mid and Double Sided and landscape screen orientation, whenever I have an odd number of pages and get to the last page I get the following error:

'The number of view controllers provided (1) doesn't match the number required (2) for the requested transition'


If I have an even number of pages, it works just fine.


How do I handle this error, should I pass an empty page (viewcontroller) when at the end of all pages, and if so, how, or can I handle it in some other more stratightforward way?

Our customers are infrequently experiencing something similar with our app, which also uses the UIPageViewController, when attempting a page turn past the last page:

'NSInvalidArgumentException: The number of view controllers provided (0) doesn't match the number required (1) for the requested transition'

It looks like UIPageViewController sometimes initiates a page transition even though it receives a nil value (no more pages) from the delegate pageViewController:viewControllerAfterViewController: data source message. We haven't been able to reproduce this, and I tried your steps but didn't have any luck. From our Apple crash reports this issue seems to have increased by a factor of 10 for our customers running on iOS 13.3+. Perhaps this is an iOS bug.

we are facing the same issue, and cannot find a solution for a while now. anybody can help?

UIPageViewController: handling odd number of pages with spine location set to mid
 
 
Q