TestFlight build 121 (048a4751), iPhone Duo, iOS 27.2.1: tapping Hex's globe killed
the app being typed in (here the Hex app) with
"-[__NSArrayM objectAtIndex:]: index 42 beyond bounds [0 .. 41]".
Symbolicated against the iPhone19,4 24B91034 dyld cache, the crash is entirely in the
host's UIKit: the extension's "next keyboard" output ->
-[_UIKeyboardStateManager setInputModeToNextInPreferredListWithExecutionContext:] ->
_setKeyboardInputMode:...updateIndicator:YES -> reinitializeAfterInputModeSwitch: ->
-[UIKeyboardImpl updateInputModeIndicatorOnSingleKeyOnly:preserveIfPossible:] ->
-[UIKeyboardLayoutStar activationIndicatorView]. That method builds the language
indicator only when Apple's keyplane has its own globe, and for a split keyplane walks
the bottom row's keys by frame; when the keys aren't laid out yet (the first switch into
Apple's keyboard in a host that opened with Hex) it reads keys[count] and throws. On an
iPad mini 27.2 simulator with Apple's split keyboard, the first call sees every key at
{0,0,0,0} but the bottom row; the iPad's geometry happens to stay in bounds, the Duo's
split keyboard (Apple splits it unfolded and upright) evidently does not.
Picking a keyboard from the list goes through
_setKeyboardInputMode:...updateIndicator:NO and never reaches that code (checked with
breakpoints on the same simulator). So where Apple's keyboard is split
(KeyboardPosture.splitsKeyboard, the Duo unfolded and upright), the globe now holds back
the lift of a touch that stayed on the key: UIKit's own 0.2 s hold then opens the list
instead of switching to the next keyboard. Holds, slides up and slide-and-pick still go
to UIKit unchanged. Everywhere else (every iPhone, the Duo folded or turned, every iPad)
the globe behaves exactly as before.
Wiring: the globe still hands this control's real UIEvents to
handleInputModeList(from:with:) for .allTouchEvents, as Apple documents; it now does so
from FullKeyboardView (globeTouch) instead of targeting the controller directly, which
is what lets it drop that one lift.
Verified (Mac Studio, iOS 27.2 simulators):
- xcodebuild test: 758 tests, 0 failures (layout tests untouched), plus
testTheGlobePassesItsTouchesToUIKit in FullKeyboardEngineTests.
- iPad mini, Apple's keyboard split, the split rule forced on by a diagnostic build:
a tap opens the list (no next-keyboard switch, no indicator call), picking English
(US) switches to Apple's split keyboard, host alive.
- Not verified on a real Duo: the Duo simulator takes no touches and can't be unfolded
(powering its inner display crashes SpringBoard), so the fix is unconfirmed there.