microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in CodePush, even though it's inherited from RCTEventEmitter #2598

Closed khushbujilka22 closed 5 months ago

khushbujilka22 commented 1 year ago

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

while downloading the code push update, it suddenly crashed with an exception.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: CodePushDownloadProgress with body: {
    receivedBytes = 1874408;
    totalBytes = 1874408;
}. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in CodePush, even though it's inherited from RCTEventEmitter.'
*** First throw call stack:
(0x180a27c80 0x19824dee4 0x1821cdde0 0x1047a1508 0x1041d6c88 0x1041d8a3c 0x1041dbb68 0x1044c4ae4 0x1044bff6c 0x1044c4944 0x1813d3bb0 0x1820f739c 0x182108a70 0x1820e2a8c 0x1820f2fcc 0x1820f6498 0x182103ccc 0x10851d1a8 0x10850dfc8 0x108515150 0x108515ddc 0x10852163c 0x1dbd94e00 0x1dbd9492c)
libc++abi: terminating with uncaught exception of type NSException`

Environment

This is happening with IOS in release and debug build both.

DmitriyKirakosyan commented 1 year ago

@khushbujilka22 , thanks for reaching out!

Does this issue happen every time, or just sometimes? Also, could you make a simple demo app that shows the problem?

There's a similar issue you might find relevant: https://github.com/microsoft/react-native-code-push/issues/2133

griffinbaker12 commented 11 months ago

happening to me as well

mununki commented 10 months ago

I'm facing the exactly same issue. Every updates are rolled back after downloaded. Any fix?

griffinbaker12 commented 10 months ago

For me, I used a variable "hasListeners" to track whether the RN side has been initialized with listeners set up, along with the start and stopObserving methods that I override on the RCTEventEmitter. If this is true, then I allow events to be sent (you can send all events through one method). I use a guard statement within that function. Hope this helps!

mununki commented 10 months ago

For me, I used a variable "hasListeners" to track whether the RN side has been initialized with listeners set up, along with the start and stopObserving methods that I override on the RCTEventEmitter. If this is true, then I allow events to be sent (you can send all events through one method). I use a guard statement within that function. Hope this helps!

Can you share the code to patch? I'm new to objective-c and iOS development.

mununki commented 10 months ago

@griffinbaker12 If I understand correctly, Is this what you mean by adding code to CodePush.m, like sending event to JavaScript's startObserving? https://reactnative.dev/docs/0.72/native-modules-ios#sending-events-to-javascript

griffinbaker12 commented 10 months ago

I used Swift in my example, but am happy to show you that if you still find it helpful.

mununki commented 10 months ago

I used Swift in my example, but am happy to show you that if you still find it helpful.

Even if you're Swift, I think it would be helpful to see how you adapted it.

MikhailSuendukov commented 7 months ago

Hi guys @mununki, @griffinbaker12 did you found the solution? If not, could you please confirm what this issue still persist on latest version (8.2.1)?

mununki commented 7 months ago

Mine was resolved https://github.com/microsoft/react-native-code-push/issues/2639

microsoft-github-policy-service[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

microsoft-github-policy-service[bot] commented 5 months ago

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.