react-native: React Native cant find RCTEventEmitter after cocoapods integration
Recently implemented cocoapods into a React Native project. Now RN is throwing this error after a successful xcode build
And on one occasion
No errors in Xcode during build time though… but Xcode gives me a warning
Which corresponds to this code in RCTUIManager.m
RCT_EXPORT_MODULE()
- (void)didReceiveNewContentSizeMultiplier
{
// Report the event across the bridge.
[_bridge.eventDispatcher sendDeviceEventWithName:@"didUpdateContentSizeMultiplier"
body:@([_bridge.accessibilityManager multiplier])];
dispatch_async(RCTGetUIManagerQueue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification
object:self];
[self setNeedsLayout];
});
}
Finally Xcode logs these errors,
2017-04-07 14:06:59.714 [info][tid:main][RCTBatchedBridge.m:72] Initializing <RCTBatchedBridge: 0x6000001a5400> (parent: <RCTBridge: 0x6080000c50f0>, executor: RCTJSCExecutor)
2017-04-07 14:07:00.409 [error][tid:com.facebook.react.JavaScript] Native module cannot be null.
2017-04-07 14:07:00.414 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Native module cannot be null.
2017-04-07 14:07:00.430 [error][tid:com.facebook.react.JavaScript] Requiring module "215", which threw an exception.
2017-04-07 14:07:00.435 [warn][tid:com.facebook.react.JavaScript] Unable to symbolicate stack trace: Native module cannot be null.
2017-04-07 14:07:00.436 [warn][tid:com.facebook.react.JavaScript] Unable to symbolicate stack trace: undefined is not a constructor (evaluating 'new XMLHttpRequest()')
2017-04-07 14:07:00.441 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Requiring module "215", which threw an exception.
2017-04-07 14:07:00.533 [info][tid:main][RCTRootView.m:275] Running application trackApp ({
initialProps = {
};
rootTag = 1;
})
2017-04-07 14:07:00.535 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
2017-04-07 14:07:00.538 [warn][tid:com.facebook.react.JavaScript] Unable to symbolicate stack trace: undefined is not a constructor (evaluating 'new XMLHttpRequest()')
2017-04-07 14:07:00.539 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Module AppRegistry is not a registered callable module (calling runApplication)
Not sure what the problem is here… Any ideas?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 18 (2 by maintainers)
Upgraded to .43 and now get this error
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
I had the same issue as @topher in “Debug” build configuration. It turned out when moving my project to a pod configuration, a “libReact.a” was left in another directory that was in the library path and being picked up by the linker (i.e. there were two libReact.a files, and the wrong one was being linked to). Since I didn’t do a Product -> Clean before I updated my project with cocoa pods it was still there. I found it by looking at the paths used in the link error message and looking for a libReact.a with an out of date timestamp.
find /Users/[myuser]/Library/Developer/Xcode/DerivedData/[myproject]-[somehashything]/ -name “libReact.a” -ls
Where […] are specific to my computer, but that is where Xcode putting this stuff. You can probably blow away that whole directory and let XCode rebuild as well.
@charlle that could be it. I haven’t had the issue for a while. Here is my current Podfile
Current Podfile
After struggling with this error and similar ones, I decided to clear out my
Libraries
folder in my xcode project by moving everything I could with a.podspec
to cocoapods.Since then, I’ve rarely had issues. If you haven’t strongly recommend using cocoapods / when building on ios and wish I had decided to earlier.
Also might may help are: (in no particular order)
cleaning xcode under Product menu
cmd + K
clearing
rm ios/build/*
react-native unlink
src/ios $
pod clean && pod deintegrate && pod install
@topher you find a solution for this issue? @hramos not sure why this issue is closed. it’s still exists.
I hade the same issue as @gaberudy and @topher, specifically for the Debug configuration.
@gaberudy’s approach worked for me.
Pro-tip: open xcode and press CMD+SHIFT+ALT+K to clean the the build folder (= DerivedData/yourproject)
I getting a same issue, but this bug occurs only in debug build.
RN .0.43 Cocoapods: 1.2.0