Critical Issue in iOS 18 Beta: UITabBarController Child View Controller Incorrectly Added as UITabBarItem, Leading to Application Crash

I am writing to report an issue I encountered with iOS 18 beta that affects my application, which has been available on the App Store for over two years and currently has over 60,000 active users.

My application utilizes a UITabBarController to manage multiple tabs, where each tab hosts a UIViewController embedded within a UINavigationController. The application operates in two different states, where users may have either 5, 4, or 3 tabBarItems depending on their configuration.

The issue arises when fewer than 5 tabs are present. In these cases, I add child view controllers to the UITabBarController to ensure they are displayed above the tab bar, rather than below it. The relevant code snippet is as follows:

tabBarController.addChild(childController) tabBarController.view.addSubview(childController.view)

Prior to iOS 18, this implementation functioned as expected. However, with the release of iOS 18, adding a child view controller to the UITabBarController results in the child being incorrectly added as a UITabBarItem. This misbehavior leads to an application crash when the unintended tab is selected.

The crash trace is as follows:

"Inconsistency in UITabBar items and view controllers detected. No view controller matches the UITabBarItem '<UITabBarItem: 0x142d9c480> selected'."

I have attached screenshots from iOS 18 and previous versions to illustrate the issue, which compares the expected behavior in earlier iOS versions with the problematic behavior in iOS 18.

I appreciate your attention to this matter and look forward to any guidance or resolution you can provide.

Please submit a complete bug report regarding this issue using Feedback Assistant (https://feedbackassistant.apple.com). For more information on Feedback Assistant.

Don't forget to include a sample project that reproduces the issue. Once you open the bug report, please post the FB number here for my reference.

Bug Reporting: How and Why? has tips on creating your bug report.

Adding a child view controller directly onto a UITabBarController (and similarly a UINavigationController) is not expected to work as they are treated as part of their respective viewControllers property and is managed by each container view controller.

Adding a child directly has never worked quite as expected and has always caused issues. The behavior you are seeing in iOS 18 is just another symptom of this issue presented differently.

You should either place the child view controller within each tab's view controller, or in a parent above the UITabBarController (i.e. as a sibling of the UITabBarController).

Hello, I have also encountered a similar problem. Have you solved it?

Critical Issue in iOS 18 Beta: UITabBarController Child View Controller Incorrectly Added as UITabBarItem, Leading to Application Crash
 
 
Q