React-native: React Native cant find RCTEventEmitter after cocoapods integration

Created on 8 Apr 2017  路  18Comments  路  Source: facebook/react-native

Recently implemented cocoapods into a React Native project. Now RN is throwing this error after a successful xcode build
screen shot 2017-04-07 at 1 39 43 pm

And on one occasion
screen shot 2017-04-07 at 9 54 10 pm

No errors in Xcode during build time though... but Xcode gives me a warning
image

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?

Locked

Most helpful comment

Upgraded to .43 and now get this error

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTReconnectingWebSocket", referenced from:
      objc-class-ref in libReact.a(RCTPackagerClient.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

All 18 comments

Had the exact same issue.

Fixed it by adding most of the React subspecs to my Podfile:

pod 'React', :path => 'node_modules/react-native', :subspecs => [
'Core',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
'RCTAnimation',
'RCTImage',
'RCTLinkingIOS',
'RCTPushNotification',
'RCTActionSheet'
]

@Warpenguin I have a simliar Podfile except I changed the path from 'node_modules/react-native'to '../node_modules/react-native', and I also have 'RCTVibration' and , 'RCTSettings'

But I'm getting a similar error after another successful build, but with different warnings

2017-04-13 20:07:30.762 [info][tid:main][RCTBatchedBridge.m:72] Initializing <RCTBatchedBridge: 0x6000001a8b20> (parent: <RCTBridge: 0x6080000da080>, executor: RCTJSCExecutor)
2017-04-13 20:07:30.913 [warn][tid:NSOperationQueue 0x60800003a1a0 :: NSOperation 0x600000241770 (QOS: DEFAULT)][RCTModuleData.mm:220] RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks
2017-04-13 20:07:32.658 [error][tid:com.facebook.react.JavaScript] Native module cannot be null.
2017-04-13 20:07:32.662 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Native module cannot be null.
2017-04-13 20:07:32.680 [error][tid:com.facebook.react.JavaScript] Requiring module "215", which threw an exception.
2017-04-13 20:07:32.685 [warn][tid:com.facebook.react.JavaScript] Unable to symbolicate stack trace: Native module cannot be null.
2017-04-13 20:07:32.686 [warn][tid:com.facebook.react.JavaScript] Unable to symbolicate stack trace: undefined is not a constructor (evaluating 'new XMLHttpRequest()')
2017-04-13 20:07:32.688 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Requiring module "215", which threw an exception.
2017-04-13 20:07:32.758 [info][tid:main][RCTRootView.m:275] Running application zelosApp ({
    initialProps =     {
    };
    rootTag = 1;
})
2017-04-13 20:07:32.759 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
2017-04-13 20:07:32.761 [warn][tid:com.facebook.react.JavaScript] Unable to symbolicate stack trace: undefined is not a constructor (evaluating 'new XMLHttpRequest()')
2017-04-13 20:07:32.762 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Module AppRegistry is not a registered callable module (calling runApplication)

screen shot 2017-04-13 at 8 28 25 pm

I've removed 'RCTConvert+MapKit.o' and 'libReact.a' is not linked so confused to what it could be.

Upgraded to .43 and now get this error

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTReconnectingWebSocket", referenced from:
      objc-class-ref in libReact.a(RCTPackagerClient.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I getting a same issue, but this bug occurs only in debug build.

RN .0.43
Cocoapods: 1.2.0

"_OBJC_CLASS_$_RCTLinkingManager", referenced from:
    objc-class-ref in AppDelegate.o

"_OBJC_CLASS_$_RCTPushNotificationManager", referenced from:
    objc-class-ref in AppDelegate.o

"_OBJC_CLASS_$_RCTReconnectingWebSocket", referenced from:
    objc-class-ref in libReact.a(RCTPackagerClient.o)

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm getting the same error in RN 0.43.3, but without cocoapods integration. ("Native module cannot be null" in simulator after successful build)

+1

same issue
@cafwilliams

Same problem as @cafwilliams. Is this a problem with the new DevSupport tools... RCTPackagerClient?

same problem here

@charlle that could be it. I haven't had the issue for a while. Here is my current Podfile

Current Podfile

pod 'React', :path => '../node_modules/react-native', :subspecs => [
  'Core',
  'RCTActionSheet',
  'RCTAnimation',
  'RCTGeolocation',
  'RCTImage',
  'RCTLinkingIOS',
  'RCTNetwork',
  'RCTSettings',
  'RCTText',
  'RCTVibration',
  'RCTWebSocket',
  'DevSupport'
  ]

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

Having same issue as @topher only on "Debug" build configuration.

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.

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)

+1 for @poyannabati, after moving to cocoapods, I had artifacts in my project's ios/build folder.

This revealed two when there should only be one (run from ios/ directory):
find ./build/ -name "libReact.a" -ls

To fix I ran:
rm -rf ./build/ (from ios/)

then react-native run-ios builds as expected.

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:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

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.

@topher you find a solution for this issue?
@hramos not sure why this issue is closed. it's still exists.

I found this issue on react-native 0.50.3 after integrating the project with Pods, but the error only shown when running in Debug mode.

Maybe my solution works for you who face this problem, by deleting all react libraries in your project and move it to Pods.

@rskull how did you solve this trouble?

Was this page helpful?
0 / 5 - 0 ratings