Bug: iOS TextInput crashes when focusing any field
Focusing any TextInput in makepad-example-text-input crashes the app on the iOS Simulator. The new native iOS text input path traps the moment a field takes focus.
I started the example as follows:
cargo makepad apple ios --org=test run-sim -p makepad-example-text-input --releaseBased on the Apple crash report, the crash happens on the main thread during UITextView becomeFirstResponder / UIKit keyboard setup:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
2 UIKitCore +[UIKeyboardAutomatic sharedInstance]
...
7 UIKitCore -[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
8 CoreFoundation __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
...
25 UIKitCore +[UIKeyboardAutomatic sharedInstance]
...
31 UIKitCore -[UIResponder becomeFirstResponder]
33 UIKitCore -[UITextView becomeFirstResponder]
34 makepad-example-text-input
makepad_platform::os::apple::ios::ios::<impl Cx>::handle_platform_ops+[UIKeyboardAutomatic sharedInstance] shows up twice in the stack, with notification delivery and reloadInputViews in between.
Environment
- macOS 26.5.1
- iOS Simulator runtime 26.5
- Apple Silicon
- Example:
makepad-example-text-input - Build:
--release - Commit tested:
bc13b891e58d512fb7bf1d319276fae74931ce7eincluding the #1121 changes.
Suspected cause
platform/src/os/apple/ios/ios_delegates.rs registers for UITextInputCurrentInputModeDidChangeNotification. The handler calls:
let () = msg_send![text_input_view, reloadInputViews];That notification can fire while UIKit is still bringing up the shared keyboard inside becomeFirstResponder. Calling reloadInputViews synchronously from the notification re-enters keyboard initialization while UIKeyboardAutomatic sharedInstance is still inside its dispatch_once, which traps.
The existing comment says the reload is there so UIKit re-queries a dynamic autocorrectionType for CJK input modes. But the current code uses a real UITextView with native setAutocorrectionType:, and IosApp::configure_keyboard already calls reloadInputViews explicitly for Makepad-initiated trait changes.
Local workaround / possible fix
Make input_mode_did_change a no-op, or defer the reload until after UIKit has finished bringing up the keyboard:
extern "C" fn input_mode_did_change(_: &Object, _: Sel, _notif: ObjcId) {
// Don't synchronously call reloadInputViews here.
}With that change, makepad-example-text-input builds cleanly for aarch64-apple-ios-sim --release and avoids the re-entrant reloadInputViews crash path.
Source: makepad/makepad