I get this error along with navigationItem.leftBarButtonItem & navigationItem.rightBarButtonItem (using UIBarButtonItem, both system or custom) not appearing in the UI on iOS16, but works perfectly in versions prior to iOS 16.
In iOS16, when I view Debug View Hierarchy, these elements seem to be completely missing.
On the left of the navigation bar:- UINavigationBar > _UINavigationBarContentView >> _UIButtonBarStackView = No Content
On the right of navigation bar: UINavigationBar > _UINavigationBarContentView >> _UIButtonBarStackView = No content
One with warning “Width and horizontal position are ambiguous” (Left)
But in iOS15.5, we see the correct content in view and reported correctly in Debug View Hierarchy
UINavigationBar > _UINavigationBarContentView > _UIButtonBarStackView = Has content, i.e. custom UIVVIew > UILabel
We're using Storyboards too.
Even when creating a new UINavigationBar() directly in the associated viewController, I get the same behaviour in iOS16 with navigationItem.leftBarButtonItem & navigationItem.rightBarButtonItem not rendering to screen or visibile in Debug View Hierarachy.
However, when using navigationController?.popToViewController(self, animated: false), the back button to the previous view renders fine and navigation bar titles work fine in iOS16, it's just navigationItem bar buttons that are not displaying.