react-native-restart
react-native-restart copied to clipboard
RNRestart.Restart(); causes error in XCode and app does not restart
Code: RNRestart.Restart(); Versions: "react-native-restart": "0.0.24", "react-native": "0.63.3", Platform: iOS Error in XCode when reloading in debug:
Assertion failed: (objectCounter_ == 0 && "JSCRuntime destroyed with a dangling API object"), function ~JSCRuntime, file JSCRuntime.cpp, line 391. CoreSimulator 783.5 - Device: iPad mini (6th generation) (18447BDD-5772-468B-9DAF-3683DE595931) - Runtime: iOS 15.2 (19C51) - DeviceType: iPad mini (6th generation)
Yes I see the same issue on my end as well on real device testing.
"react-native-restart": "^0.0.24", "react-native": "0.64.2",
2022-03-15 15:59:07.887046-0400 [native] Invalidating <RCTCxxBridge: 0x14b504510> (parent: <RCTBridge: 0x280ba4d20>, executor: (null)) 2022-03-15 15:59:07.888089-0400 [native] [GESTURE HANDLER] Tearing down gesture handler registered for views NSHashTable { [14] <RCTRootContentView: 0x14b5058b0; reactTag: 1; frame = (0 0; 390 844); gestureRecognizers = <NSArray: 0x282ee5410>; layer = <CALayer: 0x28208cb00>> } 2022-03-15 15:59:17.889634-0400 [native] Timed out waiting for modules to be invalidated
Code: RNRestart.Restart(); Versions: "react-native-restart": "0.0.24", "react-native": "0.63.3", Platform: iOS Error in XCode when reloading in debug:
Assertion failed: (objectCounter_ == 0 && "JSCRuntime destroyed with a dangling API object"), function ~JSCRuntime, file JSCRuntime.cpp, line 391. CoreSimulator 783.5 - Device: iPad mini (6th generation) (18447BDD-5772-468B-9DAF-3683DE595931) - Runtime: iOS 15.2 (19C51) - DeviceType: iPad mini (6th generation)
In my case it happened for a number of reasons:
-I had a pretty outdated version of realm, which seemed to be in conflict with react-native-reanimated
-I didn't have a hermes enabled
-I had react-native-reanimated v2+ which requires hermes to be enabled (at least on android)
So I fixed this by upgrading to release candidate version of realm which has hermes support and enabling hermes for iOS.
Closing for now