UIPageViewController Crash for "No view controller managing visible view "

Since we used the UIPageViewController control, no matter which system the model of the phone, every version always happens the same crash。 We use UIPageViewController control style is "UIPageViewControllerTransitionStyleScroll" , flip back and forth through "setViewControllers:" to set.We suspect that the crash is caused by a problem with the UIPageViewController control itself.Has anyone encountered it, and how should you avoid it

The crash log is as follows:

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x9cb4 __exceptionPreprocess
1  libobjc.A.dylib                0x183d0 objc_exception_throw
2  Foundation                     0x4e156c _userInfoForFileAndLine
3  UIKitCore                      0x7951c4 -[UIPageViewController queuingScrollView:didEndManualScroll:toRevealView:direction:animated:didFinish:didComplete:]
4  UIKitCore                      0x79f1d8 -[_UIQueuingScrollView _notifyDelegateDidEndManualScroll:toRevealView:direction:animated:didFinish:didComplete:]
5  UIKitCore                      0x7a0b3c -[_UITransitionState cleanupWithFinishedState:completedState:]
6  UIKitCore                      0x79e2e0 -[_UIQueuingScrollView _cleanUpCompletionState:didFinish:didComplete:]
7  UIKitCore                      0x7a0718 -[_UIQueuingScrollView _didEndScroll:]
8  UIKitCore                      0x7a08b8 -[_UIQueuingScrollView _didEndManualScroll]
9  UIKitCore                      0x79ce40 -[_UIQueuingScrollView _scrollViewDidEndDecelerating]
10 UIKitCore                      0x290f44 -[UIScrollView _scrollViewDidEndDeceleratingForDelegate]
11 UIKitCore                      0x290ea4 -[UIScrollView _stopScrollDecelerationNotify:]
12 UIKitCore                      0xbb238 -[UIScrollView _smoothScrollSyncWithUpdateTime:]
13 UIKitCore                      0xba960 -[UIScrollView _smoothScrollWithUpdateTime:]
14 UIKitCore                      0x387c90 -[UIScrollView _smoothScrollDisplayLink:]
15 QuartzCore                     0x2946c CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
16 QuartzCore                     0x146f28 CA::Display::DisplayLink::dispatch_deferred_display_links(unsigned int)
17 UIKitCore                      0x64e4b0 _UIUpdateSequenceRun
18 UIKitCore                      0xcb2c8c schedulerStepScheduledMainSection
19 UIKitCore                      0xcb21e8 runloopSourceCallback
20 CoreFoundation                 0xd3128 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
21 CoreFoundation                 0xdf7b4 __CFRunLoopDoSource0
22 CoreFoundation                 0x645e8 __CFRunLoopDoSources0
23 CoreFoundation                 0x7a0d4 __CFRunLoopRun
24 CoreFoundation                 0x7f3ec CFRunLoopRunSpecific
25 GraphicsServices               0x135c GSEventRunModal
26 UIKitCore                      0x39d6e8 -[UIApplication _run]
27 UIKitCore                      0x39d34c UIApplicationMain
28 ZongHeng                       0x3d6fe0 main + 20 (main.m:20)
29 ???                            0x1cfc06dec (缺少)

apple crash log is:

  • Could you show the code ?

  • UIPageViewController init method is :

    "self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; self.pageViewController.delegate = self; self.pageViewController.dataSource = self;"
  • Page turn Method is : [self.pageViewController setViewControllers:@[pageVC] direction:UIPageViewControllerNavigationDirectionReverse animated:animated completion:^(BOOL finished) { [weakObjc pageFinishedLogic]; }];