I am getting the following error when trying to build my app after enabling Cloud Messaging:
In file included from /xxx/ios/App/AppDelegate.m:6:
/xxx/../node_modules/react-native-firebase/ios/RNFirebase/RNFirebaseMessaging.h:8:9: fatal error: 'RCTEventEmitter.h' file not found
#import "RCTEventEmitter.h"
^
1 error generated.
Using "react-native": "0.42.0" and "react-native-firebase": "^1.0.0-alpha14" installed via pod like described here http://invertase.io/react-native-firebase/#/installation-ios?id=_3-cloud-messaging-optional
What am I doing wrong?
We were able to build our project if we updated the import in RNFirebaseMessaging.h statements to the following:
#import "React/RCTEventEmitter.h"
#import "React/RCTBridgeModule.h"
#import "React/RCTUtils.h"
We are on react-native 43.4 and the import statement syntax changed for these around RN 40 or 41.
@HilSny thanks for this :) off the top of your head do you know which version specifically this changed in? I can update them but just need to know which versions will break in terms of backwards compatibility. 馃檲
@Salakar looks like RN 40.0 according to this doc: https://github.com/facebook/react-native/wiki/Breaking-Changes (Search for React/RCT)
Some packages have used a strategy like in RN Vector Icons to enable backwards compatibility. See here: RNVectorIcons example
@HilSny awesome, thanks for that, helps a lot. Will fix and push up v1.0.2 to npm in the morning.
@HilSny @neuling v1.0.2 is up on NPM now with this is. Thanks for submitting the issue :)
@Salakar Thanks for fixing it so fast 馃挭馃徎
HI
RNFirebase.h
Causing
'React/RCTEventEmitter.h' file not found
Here is the entire log...
RNTemplateProjectFireBase/node_modules/react-native-firebase/ios/RNFirebase/RNFirebase.h:5:9: 'React/RCTEventEmitter.h' file not found
Please let me know if I am missing anything.
@chiragpurohit71085 Did you manage to find a workaround? I've been stuck on the same issue for three days now.
My project builds just fine before I add RNFirebase, the moment I add RNFirebase, building with xcode fails with 'React/RCTEventEmitter.h' file not found.
If you're using v3.0.X, then you no longer need to use pods for React which will minimise the chance of these errors. Otherwise, there are lots of issues already closed which discuss different ways of solving this problem, i.e. cleaning Xcode derived data, etc
@chrisbianca Thank you for the prompt response. I built my project with create-react-native-app then ejected to ExpoKit (as described here - https://docs.expo.io/versions/latest/guides/expokit.html) in order to use react-native-firebase. After ejecting to ExpoKit it looks like expo uses pods for react - here's the Podfile created automatically after ejecting
```source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'getapro' do
pod 'ExpoKit',
:git => "http://github.com/expo/expo.git",
:tag => "ios/1.20.5",
:subspecs => [
"Core",
"CPP"
]
pod 'React',
:path => "../node_modules/react-native",
:subspecs => [
"Core",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"DevSupport",
"CxxBridge"
]
pod 'Yoga',
:path => "../node_modules/react-native/ReactCommon/yoga"
pod 'DoubleConversion',
:podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
:inhibit_warnings => true
pod 'Folly',
:podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
:inhibit_warnings => true
pod 'GLog',
:podspec => "../node_modules/react-native/third-party-podspecs/GLog.podspec",
:inhibit_warnings => true
pod 'Firebase/Core'
post_install do |installer|
installer.pods_project.main_group.tab_width = '2';
installer.pods_project.main_group.indent_width = '2';
installer.pod_targets.each do |target|
if target.pod_name == 'ExpoKit'
target.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
# needed for GoogleMaps 2.x
config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Base/Frameworks'
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Maps/Frameworks'
end
end
# Build React Native with RCT_DEV enabled
next unless target.pod_name == 'React'
target.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
end
end
end
end```
I'm using react-native-firebase 3.0.3. How do I go about not using pods for React?
Adding more modules as described in the documentation results in the same error in other files too. I added pod 'Firebase/Firestore' to my Podfile right after pod 'Firebase/Core' ran pod update, deleted the DerivedData directory in xcode and reopened xcode using open myproject.xcworkspace. When i clean and build I get the same error this time in the file RNFirebaseFirestoreDocumentReference.h
Most helpful comment
@HilSny awesome, thanks for that, helps a lot. Will fix and push up v1.0.2 to npm in the morning.