facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.04k stars 24.32k forks source link

Bridge is not set. This is probably because you've explicitly synthesized the bridge in CodePush #32066

Closed PhoenixLeeSin closed 1 year ago

PhoenixLeeSin commented 3 years ago

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

iOS project insert jsbundle; when ios -> RN and RN -> ios, it will cause memory growth and app crash. code like this: RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName: moduleName initialProperties:userInfoDic launchOptions:nil]; GXBaseRNViewController *navtiveVC = [[GXBaseRNViewController alloc]initWithNavType:GXNavTypeNone]; navtiveVC.view = rootView; In order to solve the memory growth , i write - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; RCTRootView *rootView = (RCTRootView *)self.view; RCTBridge *bridge = rootView.bridge; [bridge invalidate]; bridge = nil; }

`

but it crash *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: CodePushDownloadProgress with body: { receivedBytes = 6933551, totalBytes = 6933551, }. Bridge is not set. This is probably because you've explicitly synthesized the bridge in CodePush, even though it's inherited from RCTEventEmitter.' *** First throw call stack: (0x18696a754 0x19b4317a8 0x18686c3f8 0x187c93a6c 0x1080afa0c 0x105fd99b4 0x105fdb6d8 0x105fde628 0x1871dcaa0 0x187cf4fa8 0x187be2878 0x187cf73d0 0x187be2500 0x187cf7e74 0x187cf7900 0x1093c69c8 0x1093b5de0 0x1093bdef0 0x1093bed14 0x1093cba50 0x1d25e67a4 0x1d25ed74c) libc++abi: terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: CodePushDownloadProgress with body: { receivedBytes = 6933551, totalBytes = 6933551, }. Bridge is not set. This is probably because you've explicitly synthesized the bridge in CodePush, even though it's inherited from RCTEventEmitter.' terminating with uncaught exception of type NSException

how can i solve it, ths

MikePendo commented 3 years ago

I see the same issue

noambartouv commented 3 years ago

I have the same issue

khushbujilka22 commented 1 year ago

same here, plz help

cortinico commented 1 year ago

Closing as stale. Let's open a new issue and provide all the relevant context if this is still relevant