we are also getting this crash in iOS16 and it is 100% reproduced. Please find the viewWillDisappear crashing-code and crash stack trace
func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.isNavigationBarHidden = false // App is crashing here, not first time, but when you go-back and push into Navigation again
}
2022-09-09 15:15:29.312373+0200 Catawiki[84517:342291] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to activate constraint with anchors <NSLayoutXAxisAnchor:0x600000adb400 "_UIButtonBarButton:0x1400f3830.leading"> and <NSLayoutXAxisAnchor:0x600000b54780 "UILayoutGuide:0x6000029d8e00'BackButtonGuide(0x141b2f090)'.leading"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.'
*** First throw call stack:
(
0 CoreFoundation 0x000000018040c304 __exceptionPreprocess + 172
1 libobjc.A.dylib 0x000000018005131c objc_exception_throw + 56
2 CoreAutoLayout 0x00000001a565460c -[NSLayoutConstraint setActive:] + 0
3 CoreAutoLayout 0x00000001a5654838 __55+[NSLayoutConstraint _addOrRemoveConstraints:activate:]_block_invoke + 36
4 CoreAutoLayout 0x00000001a563da54 -[NSISEngine withBehaviors:performModifications:] + 76
5 CoreAutoLayout 0x00000001a565472c +[NSLayoutConstraint _addOrRemoveConstraints:activate:] + 264
6 UIKitCore 0x000000011dae0c60 -[_UINavigationBarContentViewLayout _activateConstraintsAndUpdateViewOrderIfNecessary:] + 84
7 UIKitCore 0x000000011dae0f3c -[_UINavigationBarContentViewLayout setBackButton:] + 128
8 UIKitCore 0x000000011dad96d0 -[_UINavigationBarContentView _setupBackButton] + 240
9 UIKitCore 0x000000011dadb704 -[_UINavigationBarContentView updateContentAnimated:] + 88
10 UIKitCore 0x000000011dafaae0 -[_UINavigationBarVisualProviderModernIOS _updateContentForTopItem:backItem:animated:] + 2660
11 UIKitCore 0x000000011dafcb70 -[_UINavigationBarVisualProviderModernIOS layoutSubviews] + 580
12 UIKitCore 0x000000011dab312c -[UINavigationBar layoutSubviews] + 192
13 UIKitCore 0x000000011e89a14c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1920
14 UIKitCore 0x000000011dab2f0c -[UINavigationBar layoutSublayersOfLayer:] + 188
15 QuartzCore 0x0000000187ed749c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 440
16 UIKitCore 0x000000011e88a45c -[UIView(Hierarchy) layoutBelowIfNeeded] + 288
17 UIKitCore 0x000000011dcdf98c -[UINavigationController _positionNavigationBarHidden:edge:initialOffset:] + 584
18 UIKitCore 0x000000011dcdfb44 -[UINavigationController _positionNavigationBarHidden:edge:] + 264
19 UIKitCore 0x000000011dce0fa4 __54-[UINavigationController _unhideNavigationBarForEdge:]_block_invoke + 100
20 UIKitCore 0x000000011e88f824 +[UIView(Animation) performWithoutAnimation:] + 68
21 UIKitCore 0x000000011dce0f20 -[UINavigationController _unhideNavigationBarForEdge:] + 152
22 UIKitCore 0x000000011dce10bc -[UINavigationController _setNavigationBarHidden:edge:duration:] + 212
23 UIKitCore 0x000000011dce08ac -[UINavigationController _setNavigationBarHidden:edgeIfNotNavigating:duration:] + 380
24 UIKitCore 0x000000011dcdf72c -[UINavigationController setNavigationBarHidden:animated:] + 120
25 Catawiki 0x00000001015dcf70 $s8Catawiki22HomepageViewControllerC17viewWillDisappearyySbF + 280
26 Catawiki 0x00000001015dd0f0 $s8Catawiki22HomepageViewControllerC17viewWillDisappearyySbFTo + 56
27 UIKitCore 0x000000011dd89984 -[UIViewController _setViewAppearState:isAnimating:] + 1212
28 UIKitCore 0x000000011dd8a364 -[UIViewController __viewWillDisappear:] + 104
29 UIKitCore 0x000000011dcddcc0 -[UINavigationController _startCustomTransition:] + 1032
30 UIKitCore 0x000000011dcef050 -[UINavigationController _startDeferredTransitionIfNeeded:] + 492
31 UIKitCore 0x000000011dceff20 -[UINavigationController __viewWillLayoutSubviews] + 92
32 UIKitCore 0x000000011dcd7914 -[UILayoutContainerView layoutSubviews] + 168
33 UIKitCore 0x000000011e89a14c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1920
34 QuartzCore 0x0000000187ed749c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 440
35 QuartzCore 0x0000000187ee1f54 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 128
36 QuartzCore 0x0000000187e117d0 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 452
37 QuartzCore 0x0000000187e3d47c _ZN2CA11Transaction6commitEv + 652
38 QuartzCore 0x0000000187e3e8b0 _ZN2CA11Transaction25flush_as_runloop_observerEb + 68
39 CoreFoundation 0x00000001803700e4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
40 CoreFoundation 0x000000018036aa84 __CFRunLoopDoObservers + 512
41 CoreFoundation 0x000000018036af3c __CFRunLoopRun + 968
42 CoreFoundation 0x000000018036a75c CFRunLoopRunSpecific + 584
43 GraphicsServices 0x0000000188f60c98 GSEventRunModal + 160
44 UIKitCore 0x000000011e404b74 -[UIApplication _run] + 868
45 UIKitCore 0x000000011e408b1c UIApplicationMain + 124
46 Catawiki 0x000000010142b9c0 main + 512
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to activate constraint with anchors <NSLayoutXAxisAnchor:0x600000adb400 "_UIButtonBarButton:0x1400f3830.leading"> and <NSLayoutXAxisAnchor:0x600000b54780 "UILayoutGuide:0x6000029d8e00'BackButtonGuide(0x141b2f090)'.leading"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.'
terminating with uncaught exception of type NSException
CoreSimulator 857.7 - Device: iPhone 14 (388CDBDD-3930-4722-A6F3-662F315B940F) - Runtime: iOS 16.0 (20A360) - DeviceType: iPhone 14
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: