Post

Replies

Boosts

Views

Activity

UITabBarController repeatedly switches to first tab
This seems to be similar or related to the issue mentioned here - https://developer.apple.com/forums/thread/93904. When creating a UITabBarController that is not the initial view controller, eventually and permanently, the UITabBarController starts to switch to the first tab when tapping anywhere on the screen. However, the tap event is clearly recognized by the initial tab when I switch back to it from the first (a view indicates it was tapped). There are no tapGestureRecognizers anywhere in my code except for that found in a well-known third party library that does not have any known bugs relating to this issue. The issue also applies in the third tab that has no tapGestureRecognizers at all (the first which is defaulted to doesn't either). I also get the same sort of behavior as in the above question when repeatedly pressing tabs - switches back and forth between the tabs in a somewhat unpredictable fashion when tapping them directly. The TabBarController's initialIndex is clearly set in the viewDidLoad for that controller. When the issue emerges, tapping the screen anywhere tabBarController(_:shouldSelect:) and tabBarController(_:didSelect:) are called, but I haven't been able to figure out the call stack apart tracing it to some assembly in a dylib or indeed why. I'd really appreciate someone else's advice on this issue - I don't know if manually setting the tabs on initialisation is a solution, or if this suggests a memory leak or horrible memory issue. I don't think it's a threading issue because everything is currently done on the main thread. The issue is very hard to reproduce as the amount of time it takes is unpredictable, but has been observed on both a real iPhone 7 and on the simulator (macOS 15.6) for an iPhone 12 and iPhone SE 2nd gen (all on iOS 14.1).
5
0
1.3k
Mar ’21