Crash on _UIButtonBarItemLayout _updateItemView

With iOS 26.1 and beta 26.2, there is a crash seen for _UIButtonBarItemLayout update. Has anyone experienced this crash or has any information on this

Thread 0 name: Thread 0 Crashed: 0 libobjc.A.dylib 0x000000019daa144c objc_retain + 16 1 UIKitCore 0x00000001a680b184 -[_UIButtonBarItemLayout _updateItemView] + 360 2 UIKitCore 0x00000001a6d5ddcc -[_UIButtonBarItemLayout minimumLayoutWidthGivenMinimumSpaceWidth:] + 28 3 UIKitCore 0x00000001a6d5eeec -[_UIButtonBarItemGroupLayout recalculateLayoutWidthsGivenItemSpaceWidth:] + 304 4 UIKitCore 0x00000001a6d4ca28 -[_UIButtonBar _widthInfoForLayout:] + 188 5 UIKitCore 0x00000001a68093b4 -[_UIButtonBar _layoutBar] + 108 6 UIKitCore 0x00000001a6809328 __42-[_UIButtonBarStackView updateConstraints]_block_invoke + 44 7 UIKitCore 0x00000001a7dbea8c +[UIView(Animation) performWithoutAnimation:] + 76 8 UIKitCore 0x00000001a68092d0 -[_UIButtonBarStackView updateConstraints] + 112 9 UIKitCore 0x00000001a64707e8 -[UIView(AdditionalLayoutSupport) _previousFittingSizeInfo] + 784 10 UIKitCore 0x00000001a6470508 -[UIView(AdditionalLayoutSupport) _previousFittingSizeInfo] + 48

I think i found the issue, as somehow xcode 26.1 and iOS 26.1 simulator helped me reproduce this fairly.

The problem was I had two UIBarButtonItem created as the class level for a subclass of UINavigationController. Now, when they were getting reused due to pushViewController under the same navigationController the buttons were reused for every new controller

class A: UINavigationController {
   
 let x = UIBarButton()
ley y = UIBarButton()

func foo() {
   viewController.navigationItem.leftBarButtonItem = x
    viewController.navigationItem.rightBarButtonItem = y
}
}

It was working so far without issue except when 26.1 came in.

if i modify it to locally create buttons for every viewController it works fine but curious what has changed recently in UIKit of OS 26.1 that its not liking the re-use.

class A: UINavigationController {
   
 
ley y = UIBarButton()

func foo() {
    let x = UIBarButton() 
   viewController.navigationItem.leftBarButtonItem = x

   let y = UIBarButton()    
    viewController.navigationItem.rightBarButtonItem = y
}
}

I'm seeing a similar crash, also started on 26.1, see below.

In my case I have no instance level button var, so I'm trying to find another workaround..

Thread 0 Crashed:
0   libobjc.A.dylib                 0x308a6544c         objc_retain
1   UIKitCore                       0x31a164490         -[_UIButtonBarItemLayout _updateItemViewSizing]
2   UIKitCore                       0x31a164180         -[_UIButtonBarItemLayout _updateItemView]
3   UIKitCore                       0x31a6b6dc8         -[_UIButtonBarItemLayout minimumLayoutWidthGivenMinimumSpaceWidth:]
4   UIKitCore                       0x31a6b7ee8         -[_UIButtonBarItemGroupLayout recalculateLayoutWidthsGivenItemSpaceWidth:]
5   UIKitCore                       0x31a6a5a24         -[_UIButtonBar _widthInfoForLayout:]
6   UIKitCore                       0x31a1623b0         -[_UIButtonBar _layoutBar]
7   UIKitCore                       0x31a162324         __42-[_UIButtonBarStackView updateConstraints]_block_invoke
8   UIKitCore                       0x31b717a88         +[UIView(Animation) performWithoutAnimation:]
9   UIKitCore                       0x31a1622cc         -[_UIButtonBarStackView updateConstraints]
10  UIKitCore                       0x319dc97e4         -[UIView(AdditionalLayoutSupport) _previousFittingSizeInfo]
[...]

In my case the crash was caused indirectly by animating the viewcontrollers change inside splitViewController(_:collapseSecondary:onto:).

Not sure if that's allowed by UIKit, but similarly to your case this code has worked for more than a decade without problems until 26.1.

Anyway, after removing the animation the issue disappears.

Crash on _UIButtonBarItemLayout _updateItemView
 
 
Q