Skip to content

TextInput crashes when any text is entered while running as iOS app on apple silicon mac ("My Mac (Designed for iPhone)" target) #48544

@jobpaardekooper

Description

@jobpaardekooper

Description

When running iOS apps on apple silicon macs using the "My Mac (Designed for iPhone)" target, apps crash once you enter any text into a TextInput component.

Running the same code on an actual iOS devices works but not when running the app on Mac.

Steps to reproduce

npm i
npx pod-install

Open the project in Xcode and select "My Mac (Designed for iPhone)" as the destination. You also need to select a signing profile to make it run of course.

Start metro:

npm start

Once the app launches click on the TextInput and press any key. You will see that the app crashes.

First when you only focus the input without entering any text, the following will long many times:

Failed to get or decode unavailable reasons
Can't find or decode reasons

After you actually enter text it will crash.

React Native Version

0.76.5

Affected Platforms

Runtime - iOS, Runtime - Desktop

Output of npx react-native info

System:
  OS: macOS 15.1.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 1.77 GB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.1.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 10.9.0
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.11.11.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/jobpaardekooper/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11567975
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.1
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/jobpaardekooper/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

An uncaught exception was raised
*** -[NSXPCEncoder _checkObject:]: This coder only encodes objects that adopt NSSecureCoding (object is of class 'RCTWeakEventEmitterWrapper').
(
	0   CoreFoundation                      0x00000001961bc300 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x0000000195ca2cd8 objc_exception_throw + 88
	2   Foundation                          0x00000001972c9404 -[NSXPCEncoder _checkObject:] + 308
	3   Foundation                          0x00000001972c90d8 -[NSXPCEncoder _encodeUnkeyedObject:] + 40
	4   Foundation                          0x00000001972da128 -[NSXPCEncoder _encodeArrayOfObjects:forKey:] + 184
	5   Foundation                          0x00000001972f46fc -[NSDictionary(NSDictionary) encodeWithCoder:] + 568
	6   Foundation                          0x00000001972c9710 -[NSXPCEncoder _encodeObject:] + 488
	7   Foundation                          0x0000000197396210 -[NSAttributedString encodeWithCoder:] + 224
	8   Foundation                          0x00000001972c9710 -[NSXPCEncoder _encodeObject:] + 488
	9   RemoteTextInput                     0x00000001b5f0eda0 -[RTIDocumentState encodeWithCoder:] + 592
	10  Foundation                          0x00000001972c9710 -[NSXPCEncoder _encodeObject:] + 488
	11  Foundation                          0x00000001972ce400 _NSXPCSerializationAddInvocationWithOnlyObjectArgumentsArray + 116
	12  Foundation                          0x00000001972ce2b8 -[NSXPCEncoder _encodeInvocationObjectArgumentsOnly:count:typeString:selector:isReply:into:] + 212
	13  Foundation                          0x00000001972c7bd4 -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 1208
	14  Foundation                          0x00000001972ce1a8 -[NSXPCConnection _sendSelector:withProxy:arg1:arg2:] + 128
	15  Foundation                          0x00000001972ce0d0 _NSXPCDistantObjectSimpleMessageSend2 + 68
	16  RemoteTextInput                     0x00000001b5f13854 __52-[RTIInputSystemClient _updateTextForSessionWithID:]_block_invoke + 72
	17  RemoteTextInput                     0x00000001b5f131b8 __58-[RTIInputSystemClient enumerateServices:force:withBlock:]_block_invoke.139 + 60
	18  CoreFoundation                      0x0000000196179aa4 __NSSET_IS_CALLING_OUT_TO_A_BLOCK__ + 24
	19  CoreFoundation                      0x000000019618c990 -[__NSSetM enumerateObjectsWithOptions:usingBlock:] + 276
	20  RemoteTextInput                     0x00000001b5f13088 -[RTIInputSystemClient enumerateServices:force:withBlock:] + 288
	21  RemoteTextInput                     0x00000001b5f137d8 -[RTIInputSystemClient _updateTextForSessionWithID:] + 244
	22  RemoteTextInput                     0x00000001b5f14f5c -[RTIInputSystemClient remoteTextInputSessionWithID:documentDidChange:] + 156
	23  UIKitCore                           0x00000001c884f99c __39-[UIKBRTIPartner documentStateChanged:]_block_invoke + 136
	24  UIKitCore                           0x00000001c88543d0 __48-[UIKBRTIPartner _updateRTIStateWithCompletion:]_block_invoke + 288
	25  UIKitCore                           0x00000001c885c5ec -[UIKBRTIPartner _queryUIKitDocumentRequest:completion:] + 4336
	26  UIKitCore                           0x00000001c885a208 -[UIKBRTIPartner _queryDocumentRequest:completion:] + 136
	27  UIKitCore                           0x00000001c885427c -[UIKBRTIPartner _updateRTIStateWithCompletion:] + 312
	28  UIKitCore                           0x00000001c8852ee4 -[UIKBRTIPartner updateStateWithCompletion:updateTraits:] + 144
	29  UIKitCore                           0x00000001c884f900 -[UIKBRTIPartner documentStateChanged:] + 176
	30  UIKitCore                           0x00000001c8143d44 -[_UIKeyboardStateManager setDocumentState:] + 208
	31  UIKitCore                           0x00000001c815a5d8 -[_UIKeyboardStateManager updateKeyboardStateForInsertion:] + 104
	32  UIKitCore                           0x00000001c850df94 -[UIKBInputDelegateManager insertText:updateInputSource:] + 464
	33  UIKit                               0x0000000272d743c4 -[UIKBInputDelegateManagerAccessibility insertText:updateInputSource:] + 112
	34  UIKitCore                           0x00000001c8508288 -[UIKBInputDelegateManager insertText:] + 92
	35  UIKitCore                           0x00000001c815150c -[_UIKeyboardStateManager performKeyboardOutput:checkingDelegate:forwardToRemoteInputSource:] + 3732
	36  UIKit                               0x0000000272d657c0 -[_UIKeyboardStateManagerAccessibility performKeyboardOutput:checkingDelegate:forwardToRemoteInputSource:] + 140
	37  UIKitCore                           0x00000001c8859e80 -[UIKBRTIPartner _performKeyboardOutputOperations:] + 608
	38  UIKit                               0x0000000272d68e6c -[UIKBRTIPartnerAccessibility _performKeyboardOutputOperations:] + 100
	39  UIKitCore                           0x00000001c8858430 -[UIKBRTIPartner _queued_performTextOperations:resultHandler:] + 780
	40  libdispatch.dylib                   0x0000000103258b64 _dispatch_call_block_and_release + 32
	41  libdispatch.dylib                   0x000000010325a8a4 _dispatch_client_callout + 20
	42  libdispatch.dylib                   0x000000010326dd38 _dispatch_main_queue_drain + 1092
	43  libdispatch.dylib                   0x000000010326d8e4 _dispatch_main_queue_callback_4CF + 44
	44  CoreFoundation                      0x0000000196188e60 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
	45  CoreFoundation                      0x0000000196148a4c __CFRunLoopRun + 1996
	46  CoreFoundation                      0x0000000196147bc4 CFRunLoopRunSpecific + 588
	47  HIToolbox                           0x00000001a15b7f64 RunCurrentEventLoopInMode + 292
	48  HIToolbox                           0x00000001a15bdd54 ReceiveNextEventCommon + 636
	49  HIToolbox                           0x00000001a15bdeb8 _BlockUntilNextEventMatchingListInModeWithFilter + 76
	50  AppKit                              0x0000000199c73a08 _DPSNextEvent + 660
	51  AppKit                              0x000000019a5b3e0c -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
	52  AppKit                              0x0000000199c66ae0 -[NSApplication run] + 480
	53  AppKit                              0x0000000199c3d364 NSApplicationMain + 888
	54  AppKit                              0x0000000199e8b870 +[NSWindow _savedFrameFromString:] + 0
	55  UIKitMacHelper                      0x00000001b097ab38 UINSApplicationMain + 972
	56  UIKitCore                           0x00000001c7a473a8 UIApplicationMain + 148
	57  ReproducerApp.debug.dylib           0x00000001062fc288 __debug_main_executable_dylib_entry_point + 96
	58  dyld                                0x0000000195ce0274 start + 2840
)

Reproducer

https://github.com/jobpaardekooper/rn-textinput-crash

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions