Post

Replies

Boosts

Views

Activity

iPad App Hangs on enumeratePreferredFocusEnvironments When Using Bluetooth Keyboard
App is mostly written in Swift with some Objective-C code. Recently I discovered that connecting a Bluetooth keyboard to the iPad causes some severe 2+ second hangs in this app. Using Time Profiler has exposed the functions that are causing the hang (backtrace below), but my question is how can I stop this from happening? The CPU usage also spikes to 100%. These hangs only happen when the Bluetooth keyboard is connected to the iPad. If I turn off Bluetooth on the iPad it goes back to running smoothly. It seems to hang when I try and make touches that effect UI on the screen, but it isn't always the same actions that trigger the hang. I tried to override these methods/variables around UIKit.UIFocus but it hasn't made any difference: updateFocusIfNeeded - never hit despite being in the backtrace shouldUpdateFocus - never hit enumeratePreferredFocusEnvironments - returned empty array and is hit, but it still loops and hangs app iPad is on iOS 16.3
1
0
656
Feb ’23