react-native-health: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: healthKit:ActiveEnergyBurned:setup:success with body: { }. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in RCTAppleHealthKit, even though it's inherited from RCTEventEmitter.'

2021-10-14 15:40:31.225818+0500 nikenft[2680:1606672] [HealthKit] Background observers will be added to the app 2021-10-14 15:40:31.228034+0500 nikenft[2680:1606672] [HealthKit] Background observers added to the app 2021-10-14 15:40:31.233119+0500 nikenft[2680:1606919] *** Assertion failure in -RCTEventEmitter sendEventWithName:body:, /Users/muhammadshaheem/Documents/Work/Projects/nikenft/node_modules/react-native/React/Modules/RCTEventEmitter.m:58 2021-10-14 15:40:31.233242+0500 nikenft[2680:1606918] [connection] nw_endpoint_handler_set_adaptive_read_handler [C2 172.20.10.2:8081 ready socket-flow (satisfied (Path is satisfied), viable, interface: bridge100, ipv4, dns)] unregister notification for read_timeout failed 2021-10-14 15:40:31.233335+0500 nikenft[2680:1606918] [connection] nw_endpoint_handler_set_adaptive_write_handler [C2 172.20.10.2:8081 ready socket-flow (satisfied (Path is satisfied), viable, interface: bridge100, ipv4, dns)] unregister notification for write_timeout failed 2021-10-14 15:40:31.234060+0500 nikenft[2680:1606919] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Error when sending event: healthKit:ActiveEnergyBurned:setup:success with body: { }. RCTCallableJSModules is not set. This is probably because you’ve explicitly synthesized the RCTCallableJSModules in RCTAppleHealthKit, even though it’s inherited from RCTEventEmitter.’ *** First throw call stack: (0x1883f6708 0x19cf007a8 0x1882f83b8 0x18972181c 0x104dc1894 0x104c43374 0x10932c0b4 0x10932dde0 0x109335ef0 0x109336d48 0x109343a50 0x1d40667a4 0x1d406d74c) libc++abi: terminating with uncaught exception of type NSException terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Error when sending event: healthKit:ActiveEnergyBurned:setup:success with body: { }. RCTCallableJSModules is not set. This is probably because you’ve explicitly synthesized the RCTCallableJSModules in RCTAppleHealthKit, even though it’s inherited from RCTEventEmitter.’

image

I am getting these issues when adding Background Observer Support

#import "AppDelegate.h"

...

/* Add the library import at the top of AppDelegate.m */
#import "RCTAppleHealthKit.h"

...

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self
                                            launchOptions:launchOptions];

  ...

  /* Add Background initializer for HealthKit  */
  [[RCTAppleHealthKit new] initializeBackgroundObservers:bridge];

  ...

  return YES;
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 12
  • Comments: 15 (1 by maintainers)

Most upvoted comments

@AnnyFigueira, I believe this is an issue with this commit (https://github.com/agencyenterprise/react-native-health/commit/8d8cb16d91b4ada165a67985235468e5066b9563). It may only be an issue on M1.

same error

Probably facing the same issue.

my environments. Xcode 13.1 iOS 14.8.1 (iPhone 6s) RN 0.66.3 react-native-health 1.12.0, 1.11.0, 1.10.0

The app will close immediately after launching.

Exception NSException * “Error when sending event: healthKit:ActiveEnergyBurned:setup:success with body: {\n}. RCTCallableJSModules is not set. This is probably because you’ve explicitly synthesized the RCTCallableJSModules in RCTAppleHealthKit, even though it’s inherited from RCTEventEmitter.” 0x0000000281bc1a10

Does anyone have “Background Observers” working?