React-native-firebase: RNFirebaseNotifications.h file not found

Created on 13 Apr 2018  路  18Comments  路  Source: invertase/react-native-firebase

in iOS, I'm following the setup instructions for FCM messaging and notifications. I completed the instructions for messaging,

https://rnfirebase.io/docs/v4.0.x/messaging/ios

then got stuck in the instructions for remote notifications

https://rnfirebase.io/docs/v4.0.x/notifications/ios

However, after the first step importing #import "RNFirebaseNotifications.h"

I get the error from xcode saying RNFirebaseNotifications.h file not found

Am I missing a step?

Additionally, I'm getting a warning Sending 'messaging_notification_received' with no listeners registered when I send a test message using the Firebase console.

Notifications Build Error iOS User Issue

Most helpful comment

I have fixed it by adding to the Header Search Path the messaging and notifications paths, this way:

"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/notifications"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/messaging"

I am not pretty sure if this is right, because I do not see it in the docs. I installed all ios dependencies using pod install and I also used react-native link as the docs said. So, is this the expected behavior? or do I really missed a step?

All 18 comments

Have you added header search path in your XCode project? You can follow step 3 of this guide
https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-3

Check that you have $(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase there for all of your targets that rely on it.

P.S. This should be added automatically when you run react-native link react-native-firebase, but never hurts checking. If it is there, check your Libraries folder and make sure RNFirebase is there. In general, I think that article I link should have an answer.

checked the header search paths and the entry is there, note that I can successfully import the other headers such as

#import <Firebase.h>
#import "RNFirebaseMessaging.h"

It's just RNFirebaseNotifications.h that seems to be failing

@mypark Have you definitely installed v4? RNFirebaseNotifications was added in this version...

ah ok, I see that I have version 3.3.1 - that was the version installed when I did npm install around 2 weeks ago. I must have installed just as the upgrade happened. I'll upgrade now and read through the documentation.

I have the same issue. @IljaDaderko I have done what you said but It does not work for me. The library was linked but for some reason It did not appear in the Header Search Path. I added it, cleaned and rebuild the project, nothing happens, the issue remains.

Any ideas?

I have fixed it by adding to the Header Search Path the messaging and notifications paths, this way:

"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/notifications"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/messaging"

I am not pretty sure if this is right, because I do not see it in the docs. I installed all ios dependencies using pod install and I also used react-native link as the docs said. So, is this the expected behavior? or do I really missed a step?

@leonelpena for me the problem was that react-native link added it to to the Debug and Release lines, but not to their children Any Architecture | Any SDK. Adding the paths manually there resolved the issue. Not sure if this is a react-native or react-native-firebase issue...

screen shot 2018-05-09 at 11 40 58 am

I think in the header search paths it should be set to recursive for $(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase so the subdirectories will also be looked into for the headers.

In my case I had forgotten to do
yarn install

as @morksinaanab said, set _recursive_ and it works!

In my case as well, setting the search strategy to recursive worked !

I have fixed it by adding to the Header Search Path the messaging and notifications paths, this way:

"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/notifications"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/messaging"

I am not pretty sure if this is right, because I do not see it in the docs. I installed all ios dependencies using pod install and I also used react-native link as the docs said. So, is this the expected behavior? or do I really missed a step?

i had to do this and work it for me

I have fixed it by adding to the Header Search Path the messaging and notifications paths, this way:

"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/notifications"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/messaging"

I am not pretty sure if this is right, because I do not see it in the docs. I installed all ios dependencies using pod install and I also used react-native link as the docs said. So, is this the expected behavior? or do I really missed a step?

is this apply on RNFirebase.xcodeproject library haeder path or main project build settings header ?path?

I have fixed it by adding to the Header Search Path the messaging and notifications paths, this way:

"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/notifications"
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/messaging"

I am not pretty sure if this is right, because I do not see it in the docs. I installed all ios dependencies using pod install and I also used react-native link as the docs said. So, is this the expected behavior? or do I really missed a step?

This is still referring to the node_modules (defeating the purpose of using cocoapods). If you check in the react-native-firebase directory in node_modules, you will see there is a podspec:
image

Checking the podspec shows the name is "RNFirebase" - therefore this should be added to your podfile like so:

pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'

This will now bundle the RNFirebase code into your Pods project and you can manage the dependencies using Cocoapods! :)

Cross-linking with #2163 as that's where I'm focusing knowledge to get a fix in for v5

pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'

Just spotted this and wanted to clarify, for those now on RN 0.60.x you no longer want this in your Podfile or you'll get:

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
  - react-native-firebase (to unlink run: "react-native unlink react-native-firebase")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

(Subsequently, react-native unlink react-native-firebase will remove it)

I faced the same issue after migration to a new version of firebase from 5 to 6. I did everything as it's written in firebase migration guideline . Now, xcode cannot find required modules . Please, help if you know what the reason is.

@YuryKorovko - v6 does not have notifications-anything, see the first pinned repo in the issue

Was this page helpful?
0 / 5 - 0 ratings