I'm seeing a sporadic crash due to misconfigured auto layout constraints on the nav bar. The backtrace doesn't refer back to my code and I'm trying to figure out if this is a UIKit bug.
This app uses the nav bar in two ways:
1. It places a search bar there on some table views.
2. It places a right bar button there on some view controllers.
In neither case does it add any auto layout constraints.
In the entire app, there are only a handful of height constraints, and they don't touch the nav bar.
Am I correct in concluding this is a UIKit bug? I am very hesitant to assume so, but if not, am sure stumped about where in my code this bug could originate.
Fyi, this is a symbolicated crash received via HockeyApp. I have never seen this on my own device or simulator.
Exception Type: SIGTRAP
Exception Codes: #0 at 0x18434507c
Crashed Thread: 4
Application Specific Information:
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to activate constraint with anchors <nslayoutdimension:0x1106a48c0 "_uibuttonbarbutton:0x1106a36c0.height"=""> and <nslayoutdimension:0x1c6c7d7c0 "uilayoutguide:0x1c43ba320'uiviewlayoutmarginsguide'.height"=""> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.'
Last Exception Backtrace:
0 CoreFoundation 0x00000001848bdd04 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x0000000183b0c528 objc_exception_throw + 52
2 CoreFoundation 0x00000001848bdc4c +[NSException raise:format:] + 112
3 Foundation 0x00000001853ccd18 -[NSLayoutConstraint _setActive:mutuallyExclusiveConstraints:] + 300
4 Foundation 0x00000001853cd004 __55+[NSLayoutConstraint _addOrRemoveConstraints:activate:]_block_invoke + 72
5 Foundation 0x00000001851ef59c -[NSISEngine withBehaviors:performModifications:] + 164
6 Foundation 0x00000001853cced4 +[NSLayoutConstraint _addOrRemoveConstraints:activate:] + 328
7 UIKit 0x000000018e6d15f8 -[_UIButtonBar _layoutBar] + 3332
8 UIKit 0x000000018e6d34ec -[_UIButtonBarStackView updateConstraints] + 48
9 UIKit 0x000000018e7f2bb0 -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] + 184
10 UIKit 0x000000018e7f3078 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 1004
11 UIKit 0x000000018e7f2f50 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 708
12 Foundation 0x00000001851ef59c -[NSISEngine withBehaviors:performModifications:] + 164
13 UIKit 0x000000018e7f32c4 -[UIView(AdditionalLayoutSupport) _recursiveUpdateConstraintsIfNeededCollectingViews:forSecondPass:] + 120
14 UIKit 0x000000018e7f2f50 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 708
15 Foundation 0x00000001851ef59c -[NSISEngine withBehaviors:performModifications:] + 164
16 UIKit 0x000000018e7f3810 __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 88
17 UIKit 0x000000018e7f23fc -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 112
18 UIKit 0x000000018e7f342c -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 164
19 UIKit 0x000000018e7efc2c -[UIView(AdditionalLayoutSupport) _systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:hasIntentionallyCollapsedHeight:] + 336
20 UIKit 0x000000018e7ef990 -[UIView(UIConstraintBasedLayout) systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:] + 256
21 UIKit 0x000000018e089c00 -[UINavigationController _navigationBarSizeForViewController:proposedHeight:verticalFittingPriority:allowRubberBandStretch:] + 364
22 UIKit 0x000000018e088b6c -[UINavigationController _calculateTopViewFramesForLayoutWithViewController:contentScrollView:navBarFrame:topPaletteFrame:topLayoutType:] + 868
23 UIKit 0x000000018e087f5c -[UINavigationController _updateTopViewFramesToMatchScrollOffsetInViewController:contentScrollView:topLayoutType:] + 116
24 UIKit 0x000000018e08ad84 -[UINavigationController _observeScrollViewDidScroll:topLayoutType:] + 244
25 UIKit 0x000000018dff67bc __54-[UIScrollView(UIScrollViewInternal) _notifyDidScroll]_block_invoke + 76
26 UIKit 0x000000018dff6c98 -[UIScrollView(UIScrollViewInternal) _enumerateAllScrollObserversWithBlock:] + 232
27 UIKit 0x000000018dff6754 -[UIScrollView(UIScrollViewInternal) _notifyDidScroll] + 152
28 UIKit 0x000000018dd13084 -[UIScrollView setContentOffset:] + 400
29 UIKit 0x000000018dff8ba0 _UIScrollViewAdjustForOverlayInsetsChangeIfNecessary + 360
30 UIKit 0x000000018dff8e10 -[UIScrollView(UIScrollViewInternal) setSafeAreaInsets:] + 272
31 UIKit 0x000000018dfc7cb8 -[UIView _eagerlyUpdateSafeAreaInsetsToDescendant:] + 368
32 UIKit 0x000000018e05cc68 -[UIViewController _updateViewSafeAreaInsetsAndEagerlyUpdateContentScrollView:] + 464
33 UIKit 0x000000018e05d234 -[UIViewController _setContentOverlayInsets:andLeftMargin:rightMargin:] + 776
34 UIKit 0x000000018e05ea1c __121-[UIViewController __updateContentOverlayInsetsWithOurRect:inBoundsOfAncestorViewController:viaImmediateChildOfAncestor:]_block_invoke + 384
35 UIKit 0x000000018e05e868 -[UIViewController __updateContentOverlayInsetsWithOurRect:inBoundsOfAncestorViewController:viaImmediateChildOfAncestor:] + 2636
36 UIKit 0x000000018e05dcc4 -[UIViewController _updateContentOverlayInsetsFromParentIfNecessary] + 584
37 UIKit 0x000000018e05d47c -[UIViewController _updateContentOverlayInsetsForSelfAndChildren] + 104
38 UIKit 0x000000018dd9c8ec -[UINavigationController _layoutViewController:] + 136
39 UIKit 0x000000018dd9a440 -[UINavigationController _layoutTopViewController] + 256
40 UIKit 0x000000018dd9b50c -[UINavigationController _startDeferredTransitionIfNeeded:] + 1288
41 UIKit 0x000000018dd9af0c -[UINavigationController __viewWillLayoutSubviews] + 160
42 UIKit 0x000000018dd9ae0c -[UILayoutContainerView layoutSubviews] + 184
43 UIKit 0x000000018dcf22f8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1272
44 QuartzCore 0x00000001888abec8 -[CALayer layoutSublayers] + 180
45 QuartzCore 0x00000001888affa8 CA::Layer::layout_if_needed(CA::Transaction*) + 328
46 QuartzCore 0x000000018881ea98 CA::Context::commit_transaction(CA::Transaction*) + 332
47 QuartzCore 0x0000000188844eb4 CA::Transaction::commit() + 536
48 QuartzCore 0x000000018884559c CA::Transaction::release_thread(void*) + 240
49 libsystem_pthread.dylib 0x00000001844e7680 _pthread_tsd_cleanup + 568
50 libsystem_pthread.dylib 0x00000001844e73d0 _pthread_exit + 84
51 libsystem_pthread.dylib 0x00000001844e7168 _pthread_wqthread + 1336
52 libsystem_pthread.dylib 0x00000001844e6c20 start_wqthread + 0