Home > Software engineering >  ReactNative iOS sendEventWithName cause "RCTCallableJSModules is not set"
ReactNative iOS sendEventWithName cause "RCTCallableJSModules is not set"

Time:09-27

i've the following situation.

2 identical react-native apps (differs only for bundleId, app icon etc) structured like this:

-> project structure

My goal it's to emit an event from native side to the JS layer through the bridge when a push notification has been received or tapped by the user (assuming that the app is in foreground and app has finished launching). On the first App the following code works as expected when i trigger a push notification to my simulator with the command xcrun simctl push <device-id> <bundleId> <filename>.apns, the second app crash immediatly with the following error:

Thread 1: "Error when sending event: pushDelivered with body: <the string passed as body>. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in CustomEventsEmitter, even though it's inherited from RCTEventEmitter."

-> xcode view

Here is the code implementation of RCTEventEmitter's sendEventWithName that provoke the assertion.

I don't know if it's a problem with my implementation. In 1 of the 2 apps works like a charm, in the other

  • Related