Pageboy
Pageboy copied to clipboard
Crash: NSInternalInconsistencyException - Unexpected subviews
I've tried dismiss
, endEditing
and isActive = false
before turning the viewController in PageboyViewControllerDataSource
, but it seems this doesn't happen soon enough for the crash to happen.
Steps to reproduce:
- Add two viewControllers, one which uses a UISearchController
- Open the page with the search controller, and select it so the keyboard presents
- Try to switch pages without dismissing the search controller keyboard
- Experience the following crash:
- I have confirmed that manually dismissing the UISearchController via a different button, then switching pages, prevents the crash.
2019-08-15 10:27:13.858884-0500 Payment[22260:1738119] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unexpected subviews'
*** First throw call stack:
(
0 CoreFoundation 0x000000011353d6fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000112ae1ac5 objc_exception_throw + 48
2 CoreFoundation 0x000000011353d482 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010ff41927 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 UIKitCore 0x000000011cd6c4ce -[_UIQueuingScrollView _setWrappedViewAtIndex:withView:] + 379
5 UIKitCore 0x000000011cd6cbda -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:] + 720
6 UIKitCore 0x000000011cd6e5d8 -[_UIQueuingScrollView _enqueueAnimatedScrollInDirection:withView:completion:] + 2400
7 UIKitCore 0x000000011cd6f20a -[_UIQueuingScrollView setView:direction:animated:completion:] + 145
8 UIKitCore 0x000000011cd5ff19 -[UIPageViewController _setViewControllers:withScrollInDirection:animated:completion:] + 650
9 UIKitCore 0x000000011cd600c7 -[UIPageViewController setViewControllers:direction:animated:completion:] + 263
10 Pageboy 0x0000000110ef7aa3 $s7Pageboy0A14ViewControllerC07_updateB11Controllers33_851B1239E1F9FEE02C965B8A745BA4AFLL2to4fromAF9direction8animated5async5force10completionySaySo06UIViewC0CG_S2iAC19NavigationDirectionOS3bySbcSgtFyycfU0_ + 1571
11 Pageboy 0x0000000110efa6d8 $s7Pageboy0A14ViewControllerC07_updateB11Controllers33_851B1239E1F9FEE02C965B8A745BA4AFLL2to4fromAF9direction8animated5async5force10completionySaySo06UIViewC0CG_S2iAC19NavigationDirectionOS3bySbcSgtFyycfU0_TA + 72
12 Pageboy 0x0000000110ef7e37 $s7Pageboy0A14ViewControllerC07_updateB11Controllers33_851B1239E1F9FEE02C965B8A745BA4AFLL2to4fromAF9direction8animated5async5force10completionySaySo06UIViewC0CG_S2iAC19NavigationDirectionOS3bySbcSgtFyycfU1_ + 55
13 Pageboy 0x0000000110efa731 $s7Pageboy0A14ViewControllerC07_updateB11Controllers33_851B1239E1F9FEE02C965B8A745BA4AFLL2to4fromAF9direction8animated5async5force10completionySaySo06UIViewC0CG_S2iAC19NavigationDirectionOS3bySbcSgtFyycfU1_TA + 17
14 Pageboy 0x0000000110ef7e7d $sIeg_IeyB_TR + 45
15 libdispatch.dylib 0x00000001154d6d7f _dispatch_call_block_and_release + 12
16 libdispatch.dylib 0x00000001154d7db5 _dispatch_client_callout + 8
17 libdispatch.dylib 0x00000001154e5080 _dispatch_main_queue_callback_4CF + 1540
18 CoreFoundation 0x00000001134a48a9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
19 CoreFoundation 0x000000011349ef56 __CFRunLoopRun + 2310
20 CoreFoundation 0x000000011349e302 CFRunLoopRunSpecific + 626
21 GraphicsServices 0x000000011632f2fe GSEventRunModal + 65
22 UIKitCore 0x000000011d3dcba2 UIApplicationMain + 140
23 Payment 0x000000010d8aeeeb main + 75
24 libdyld.dylib 0x000000011554c541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Facing exactly the same issue here, any hack?
This is what worked for me:
I have confirmed that manually dismissing the UISearchController via a different button, then switching pages, prevents the crash.