Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'FirebaseAnalytics/FirebaseAnalytics.h' file not found #1016

Closed
andr3a88 opened this issue Apr 24, 2018 · 20 comments
Closed

'FirebaseAnalytics/FirebaseAnalytics.h' file not found #1016

andr3a88 opened this issue Apr 24, 2018 · 20 comments

Comments

@andr3a88
Copy link

andr3a88 commented Apr 24, 2018

Issue: Cannot build the project

After updating RNFirebase´and Firebase` iOS SDK cannot build the project:

  • 'Firebase.h' file not found with <angled> include; use "quotes" instead in RNFirebaseUtil.h
  • 'FirebaseAnalytics/FirebaseAnalytics.h' file not found in Firebase.h
  • In file included from .../node_modules/react-native-firebase/ios/RNFirebase/admob/RNFirebaseAdMobRewardedVideo.m:2:

Environment

iOS 11.3
macOS High Sierra
Xcode 9.3
ReactNative 0.55.1
RNFirebase Version: 4.0.5

Firebase version:
Firebase 4.13.0
FirebaseAnalytics
FirebaseCore 4.0.20

@jeanregisser
Copy link
Contributor

jeanregisser commented Apr 24, 2018

Do you use CocoaPods for Firebase/* and RNFirebase?

@AndreiCalazans
Copy link
Contributor

Environment
OS: macOS High Sierra 10.13.4
Node: 9.4.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.1 => 0.55.1

I'm having the same issue. I was able to get passed the Firebase.h by adding Firebase.h into project_root/ios/Firebase/Firebase.h .

but I'm still getting the second error.

In Firebase.h

'FirebaseAnalytics/FirebaseAnalytics.h' file not found

I installed it manually, I'm not using CocoaPods.

Steps to reproduce:

  1. yarn add react-native-firebase
  2. react-native link react-native-firebase
  3. Add GoogleService-Info.plist to /ios/appName/
  4. Drag Firebase framework files to project root inside xcode as the README of Firebase specified
  5. Add the -ObjC flag to "Other Linker Settings":

@chrisbianca
Copy link
Contributor

Please take a look at option 2 of https://rnfirebase.io/docs/v4.0.x/installation/ios#1.3.-Install-Firebase-Library

This explains that if you're not using cocoapods, you need to add the frameworks to an ios/Firebase folder for them to be picked up by RNFirebase.

@AndreiCalazans
Copy link
Contributor

Thanks @chrisbianca I totally missed out on that.

For anyone else trying to get this to work manually. The following steps worked for me.

  1. yarn add react-native-firebase
  2. react-native link react-native-firebase
  3. Add GoogleService-Info.plist to /ios/appName/
  4. Download the Firebase sdk zip.

Note: Here instead of following the readme inside the Firebase folder you downloaded follow the below steps.

  1. Create a Firebase folder in root/ios/Firebase.

  2. Copy the folder Analytics and all other module folders you pretend to use, the module.modulemap file and Firebase.h inside to root/ios/Firebase.

  3. In xcode and in your build settings for your project (You need to have your project selected under targets and not just under Project). search for Header Search Paths and add this $(SRCROOT)/Firebase

  4. Then Search for Framework Search Paths and add this $(SRCROOT)/Firebase.

  5. Search for Other Linker Settings and add the -ObjC

  6. in ios/[YOUR APP NAME]/AppDelegate.m add #import <Firebase.h> at the top.

  7. still in AppDelegate.m add [FIRApp configure]; in the beginning of the method didFinishLaunchingWithOptions:(NSDictionary *)launchOptions.

Once you have done the above steps rebuild your app and it should be fine.

@willbattel
Copy link

@chrisbianca any idea why we're getting the same error even though we have always used Cocoapods? We started getting this error after the iOS SDK had their hiccup with 4.12.0. We now get this no matter what version we use.

screen shot 2018-04-28 at 8 12 44 pm

  pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios/RNFirebase.podspec'
  pod 'Firebase/Core'
  pod 'Firebase/AdMob'
  pod 'Firebase/Analytics'
  pod 'Firebase/Auth'
  pod 'Firebase/Database'
  pod 'Firebase/Performance'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Storage'
  pod 'Fabric', '~> 1.7.2'
  pod 'Crashlytics', '~> 3.9.3'

Environment:
  OS: macOS High Sierra 10.13.4
  Node: 6.10.3
  Yarn: 1.6.0
  npm: 5.6.0
  Watchman: 4.9.0
  Xcode: Xcode 9.3 Build version 9E145
  Android Studio: 3.0 AI-171.4408382

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: 0.55.3 => 0.55.3
  react-native-firebase: 4.0.6 => 4.0.6

@willbattel
Copy link

Actually, I can't get it to work even if I do include+link the SDK in the ios directory. I followed the instructions shared by AndreiCalazans but no bueno.

I don't have any idea what changed between it working and not working. I'm using version control and can't find any changes to the Podfile, Podfile.lock, etc...

@loukandr
Copy link

loukandr commented May 14, 2018

In my case, what was missing from @AndreiCalazans ' instructions to fix my problem was one more step at the end, just before building the project, that is:

12: In Xcode right click the project name folder, select Add files to “appName” and select the ios/Firebase folder.

@malangaveuday
Copy link

@AndreiCalazans, I am confused in this two files the module.modulemap file and Firebase.h, I am not able to see this in react-native-firebase sdk.

@mycob
Copy link

mycob commented Jul 24, 2018

@AndreiCalazans Thanks for your help!

@kolohelios
Copy link

I wasn't able to do get what @loukandr suggests to work, but adding the Frameworks as individual files instead of the whole folder did work. Thanks to both @loukandr and @AndreiCalazans !

@Aung-Myint-Thein
Copy link

Aung-Myint-Thein commented Aug 31, 2018

I have managed to followed @AndreiCalazans and @loukandr .. but after that i get a different error and it says "undefined symbols for architecture x86_64 react native" :( Anyone faced it and solved it before?

I am using the following:

"react-native": "^0.55.4",
"react-native-firebase": "^4.3.7",
Firebase iOS SDK - 5.3.0

I am only using DynamicLink and Messaging. Following is the trace:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FIRAnalytics", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseAnalytics.o)
  "_OBJC_CLASS_$_FIRAnalyticsConfiguration", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseAnalytics.o)
  "_OBJC_CLASS_$_FIRApp", referenced from:
      objc-class-ref in AppDelegate.o
      objc-class-ref in libRNFirebase.a(RNFirebase.o)
      objc-class-ref in libRNFirebase.a(RNFirebaseUtil.o)
  "_OBJC_CLASS_$_FIRDynamicLinkAndroidParameters", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseLinks.o)
  "_OBJC_CLASS_$_FIRDynamicLinkComponents", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseLinks.o)
  "_OBJC_CLASS_$_FIRDynamicLinkComponentsOptions", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseLinks.o)
  "_OBJC_CLASS_$_FIRDynamicLinkGoogleAnalyticsParameters", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseLinks.o)
  "_OBJC_CLASS_$_FIRDynamicLinkIOSParameters", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseLinks.o)
  "_OBJC_CLASS_$_FIRDynamicLinkItunesConnectAnalyticsParameters", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseLinks.o)
  "_OBJC_CLASS_$_FIRDynamicLinkNavigationInfoParameters", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseLinks.o)
  "_OBJC_CLASS_$_FIRDynamicLinkSocialMetaTagParameters", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseLinks.o)
  "_OBJC_CLASS_$_FIRDynamicLinks", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseLinks.o)
  "_OBJC_CLASS_$_FIRInstanceID", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseInstanceId.o)
      objc-class-ref in libRNFirebase.a(RNFirebaseMessaging.o)
  "_OBJC_CLASS_$_FIRMessaging", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebaseMessaging.o)
  "_OBJC_CLASS_$_FIROptions", referenced from:
      objc-class-ref in libRNFirebase.a(RNFirebase.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)```

@Aung-Myint-Thein
Copy link

I set up using pod and it is working fine. So, maybe above comment is not valid anymore. Thanks guys! Followings are the steps I did in my project:

react-native unlink react-native-firebase
react-native install --save react-native-firebase
cd ios
pod init
pod update
pod install (will get some warnings but the above link shows how to solve them. open xcworkspace file in xcode and solve them.)
react-native link react-native-firebase
open xcworkspace file in xcode.
Build

@JulienMalige
Copy link

@AndreiCalazans your comment should be part of the doc ("without cocoapods" section)

@henkkasoft
Copy link

henkkasoft commented Jan 15, 2019

Thank you @AndreiCalazans @loukandr @kolohelios for saving my day! @JulienMalige suggestion for updating the docs for "without cocoapods" -parts would be really helpful for others like me not using Cocoapods.

I am quite noob specially with iOS development and used react-native-firebase first with Android and now it took 2 days to get it working in iOS. Yesterday I tried to use Cocoapods but it broke some other libraries so today I started to install react-native-firebase without cocoapods. Some comments for my installation problems:

For some reason my $(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase was broken. I might broke something myself but I did "react-native link react-native-firebase" on Windows environment. My url was using \ instead of / and xCode did not understand that at all when started to work on MAC with iOS. Then I noticed that when I updated project.pbxproj directly in editor it did not get updated to Xcode even with Xcode->Product->Clean, Xcode shutdown, Library->Developer->Xcode->DerivedData deletion. So I edited them again in Xcode. Maybe some cache problem still?

For noobs like me @AndreiCalazans step 7 would need addition that the $(SRCROOT)/Firebase should be set recursive. And the step 8 would be good to point that you have to search "Framework Search Paths" so that the Build Settings "All" is selected. I had the Customized selected and it was not found.

For the step 4: To help to find the Firebase SDK zip here is a link: https://firebase.google.com/docs/ios/setup
At the bottom is the instructions to Integrate without CocoaPods and the link. (I was wondering how to know what version of SDK I have after download the zip?)

And finally @loukandr great suggestion for adding the ios/Firebase folder did not help but the @kolohelios suggestion to add all frameworks separately did work!

There was different kind of error messages I had before this was solved. Here are some I still remember:

  • "RNFirebaseNotifications.h file not found"
  • And something like: "Undefined symbols for architecture ... libRNFirebase.a"

@tenchoklang
Copy link

tenchoklang commented Jan 25, 2019

For anyone who is still having trouble, I had to modify @AndreiCalazans step 6 and 7 (for step 7 I followed @henkkasoft).For step 6 instead of dragging the entire folder like the Analytics folder into the root/ios/firebase drag the contents within the folder, if your desired sdk file has a folder called RESOURCES drag the contents of that file too. As far as the executables if there is any they dont have to be added i think. I also had to restart xcode and android studio as the app kept crashing when opened. And thank you @AndreiCalazans

@AndresCardonaDev
Copy link

HI Guys, i just ran into the same issue, and i read aggain the documentation from the Cocoapod, it says, that the pod for just Firebase needs to be added, then any sub module, so i leaved my configuration as follows and no more File not found exception or anything:

  pod 'Firebase', '~> 5.0.1'
  pod 'Firebase/Core', '~> 5.0.1'
  pod 'Firebase/Auth', '~> 5.0.1'
  pod 'Firebase/Database', '~> 5.0.1'
  pod 'Firebase/Firestore', '~> 5.0.1'
  pod 'Firebase/Messaging', '~> 5.0.1'

(Note, i don't know cocoapods, i come from maven world, but react-native happens and here i am :D, i think is better to set an specific version, and remember to run pod update && pod install on your project, as Firebase startup guide suggests

@MWSPL
Copy link

MWSPL commented Mar 29, 2019

Removing pod 'Firebase/Messaging' and re-installing it solve the issue it seems for

X-code - 10
swift - 4.2
Deployment target - 10.0

@bernhardt1
Copy link

@AndreiCalazans

There is one crucial step you've missed that I had to work through to get my build to pass.

@ step 4) DO NOT DOWNLOAD THE IOS SDK THAT FIREBASE RECOMMENDS. You must check the supported versions table to make you iOS SDK version match with the react-native version you are using + the react-native-firebase version you have installed: https://github.com/invertase/react-native-firebase/tree/v5.x.x#supported-versions---react-native--firebase

You can download the correct version from here: https://github.com/firebase/firebase-ios-sdk/releases/tag/5.20.2

@BartoszFicek
Copy link

If you use CocoaPods, just add these lines to your Podfile:

 post_install do |installer|
    rnfirebase = installer.pods_project.targets.find { |target| target.name == 'RNFirebase' }
    rnfirebase.build_configurations.each do |config|
      config.build_settings['HEADER_SEARCH_PATHS'] = '$(inherited) ${PODS_ROOT}/Headers/Public/**'
    end
  end

@Air-Craft
Copy link

This worked for me. I'm guessing that firebase has nested folders and the non-recursive default by CP doesn't find the modulemaps?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests