React-native-firebase: 馃敟 v5 iOS build failure following docs (headers not found, partial solution)

Created on 25 May 2019  路  23Comments  路  Source: invertase/react-native-firebase

There have been a mountain of install errors related to iOS and header files.

Actually there are also a mountain of errors about notifications and messaging, so I was going to make a demonstrator that showed minimal use of all features.

But while making it I hit the iOS / header file problems, so we'll start there

Here's a repo you can clone that will show the problem: https://github.com/mikehardy/rnfbdemo

Clone it, put your firebase config files in the root, run make-demo.sh, and unless my mac has a unique problem, you will have problems like this

 fatal error: 'FirebaseCore/FIRAnalyticsConfiguration.h' file not found
../../../ios/Pods/Headers/Public/Firebase/Firebase.h:1:9: fatal error: 'FirebaseCore/FirebaseCore.h' file not found

in the build

I will begin applying some of the fixes in related issues here to see if I can find the problem, but just showing the problem with easy reproduction is hopefully useful

In case it matters, the base tools are:
XCode + react-native-cli + macOS all current stable as of 20190524


Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

馃搶 pin

Most helpful comment

I'm going to close this now because it is fixed on react-native 0.60, but I will note that for react-native 0.59 you still need the workaround.

I maintain (and frequently check, for troubleshooting purposes) working builds of each, so you may refer to my example Podfiles and build setups by examining the script that fits your react-native version here:

All 23 comments

I have a partial solution now, following a comment on a previous thread, if I add this line as postinstall in Podfile to manually copy headers files, iOS build works. So there must have been some bitrot with regards to file locations? I say partial solution because a real solution would be a PR to the link script but my react-native CLI link-fu is non-existent

https://github.com/mikehardy/rnfbdemo/commit/192a341509422db5fea894a92688ae49bcc19e1b

  system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")

@Salakar @Ehesp you may be interested in this - it might reproduce the current ios build problems with a pointer to the exact issue? I'm still fuzzbusting through it, but this was the first reproducible result I achieved

Current status is that the demo doesn't run because the GoogleService-Info.plist is copied in place but not added to the project, I'll have that sorted in a bit

Some progress to report, I have my demo project successfully / repeatedly-via-script building a fresh react-native example app, adding in react-native-firebase and booting up on iOS and Android, with messaging dependencies installed.

The iOS header path bug mentioned here is the only one I've encountered so far, and I have a workaround as it stands.

Demonstrating all the messaging functionality is next, then we can just point all the install / header file / notifications / messaging bugs to the app creation script + App.js where all will be clearly demonstrated

https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

https://github.com/mikehardy/rnfbdemo now correctly builds and archives. The workaround I have in the Podfile appears to be valid. I'm going to start resolving header not found issues in favor of this one, and hopefully we can resolve it for real

Hi @mikehardy, I've just found that the problem is the version, version 6.2.0 doesn't create the folder "Firebase" inside the pod FirebaseCore, I switched to 6.3.0 and it works, the folder with all the .h is generated.

At first I installed 6.2.0 because it was on the docs (5.5.X release notes)

That would be great news! Can you confirm if you cline the rnfbdemo project and alter the podfile so it doesn't have the workaround that it works? If so we could use a. PR for the docs to expand pod range to 6.3 and mention the problem ...

I still had the bug on 6.3 and thanks to your fix it is working now @mikehardy . Indeed adding the post_install line solved the problem.

I'm going to close this now because it is fixed on react-native 0.60, but I will note that for react-native 0.59 you still need the workaround.

I maintain (and frequently check, for troubleshooting purposes) working builds of each, so you may refer to my example Podfiles and build setups by examining the script that fits your react-native version here:

@mikehardy Where are you finding the '~> 6.5.0' pod versions?

The official documentation currently only lists as latest

'~> 6.3.0'

Source: All modules in https://rnfirebase.io/docs/v5.x.x

@leotm the official documentation also warns that for ios13 you need 6.5.0 https://rnfirebase.io/docs/v5.x.x/getting-started#Supported-versions---React-Native-/-Firebase - and in fact the point of the v5.x.x branch is to keep up with current SDKs (which are at 6.9.0 now for the iOS pods)

I've got a PR in to update the docs to be more clear https://github.com/invertase/react-native-firebase-docs/pull/217/files#diff-57449f6e2343282f9fc6c71578937ac5R150 - but it needs approval from @Salakar or @Ehesp and a merge

Cheers @mikehardy , looks like I should _get started_ before diving in!

One last question:

(which are at 6.9.0 now for the iOS pods)

How did you find 6.9.0 is out? I couldn't find a source

@leotm for me since I'm doing triage on github and discord pretty frequently I reference people into links on the ios or android release notes about once every couple days, so I see them quickly. And I have a once a week habit of running yarn outdated and pod outdated in my project, which I should really stop doing because then I upgrade everything and run into the bugs before everyone else fixes them ;-)

@leotm https://cocoapods.org/pods/Firebase :D

Ah yes and https://github.com/firebase/firebase-ios-sdk/releases 馃檲
Can't rely too much on Google with new things.

@mikehardy Awesome 馃憣
Haha yes or update everything but keep react-native to the latest patch version!

@leotm I have actually found that the release notes on their doc site lag a bit, but pod outdated never lies :-). Seems like that releases page might be good too. I wish github let you subscribe to releases pages (or changes to a single file like CHANGELOG.md), that'd be nice.

I'm going to close this now because it is fixed on react-native 0.60, but I will note that for react-native 0.59 you still need the workaround.

I maintain (and frequently check, for troubleshooting purposes) working builds of each, so you may refer to my example Podfiles and build setups by examining the script that fits your react-native version here:

@mikehardy I have RN 0.61.1 and still have this problem:

/ios/Pods/Headers/Public/Firebase/Firebase.h:1:9: 'FirebaseCore/FirebaseCore.h' file not found

Why do you think?
I only have

pod 'Firebase/Core', '~> 6.3.0'

for firebase in my podfile.

@co-de I don't reproduce this in my project and I am on 0.61.2
My rnfbdemo script similarly does not reproduce it
I hate to just say "your project is messed up somehow" because that sucks, but I think it's true...

I swear by npx react-native-clean-project as a make-sure-you-are-locally-clean step and then after that I don't know what to suggest other than careful examination of your local project iOS setup

You can always use rnfbdemo here https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh to kick out a sample project for comparison

Possibly worth noting they are on Pods version 6.10.0 now - and I'm using it so it is the basis of my statement "I don't reproduce this in my project", I haven't checked pods 6.3.0 in forever

@mikehardy I have RN 59 and the workaround fixes the Build and Archive.
It works fine running on Simulator, but after shipping it with Fastlane I get this error on TestFlight

Error You attempted to use a firebase module that's not installed natively on your iOS project by calling firebase.config().

Ensure you have the required Firebase iOS SDK pod for this module included in your Podfile, in this instance confirm you've added "pod 'Firebase/RemoteConfig'" to your Podfile

I do have RemoteConfig in my Podfile

  ...
  pod 'Firebase/Analytics', '~> 6.13.0'
  pod 'Firebase/Core', '~> 6.13.0'
  pod 'Firebase/RemoteConfig', '~> 6.13.0'
  pod 'GoogleIDFASupport', '~> 3.14.0'
end

post_install do |installer|
  system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")
end

any idea?

I also noticed that I don't have FirebaseRemoteConfig Framework listed in the Pods as I do have Firebase Analytics
and the file RNFirebaseRemoteconfig.h is trying to import a file that I cannot jump to definition
#if __has_include(<FirebaseRemoteConfig/FirebaseRemoteConfig.h>)

image

UPDATE
In the end, it worked using Firebase 6.2.0

Glad you got it working! I will say for my part I am still on v5 actually (though I have v6 tests here and there). v5 still builds and works, with the most up to date Android and iOS SDKs, at least on react-native 0.60/0.61 (though I think RN59 just fine as well from what I can tell). Any time I see build failures with release mode on iOS vs debug, react-native-clean-project is my go-to it fixes them most times, with the remaining cases being something terribly hard to find in the library/file path configs between the two (they should be the same for release and debug but for some people they drift)

So glad I found this post! 馃帀 馃帀 馃帀

Been struggling to get this working until I found this magical line of code:

post_install do |installer|
  system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")
end

I am using an older version of RNFirebase as, like a lot of other people, have yet to migrate to RN 60+.
I've looked through 100s of posts of people saying to clean caches, delete lock files, and restart my pc; none of which worked.
I feel like this code should be put at a pinned issue or on the readme as many people are having issues.
I am also using use_frameworks! which seems to cause a lot of grief, but I need it for another library.

My versions I'm using:

"react-native": "0.59.10",
"react": "16.8.3",
"react-native-firebase": "5.5.7",

My Pod file (I have _manually linked RNFirebase_ in XCode as had an error when adding as a Pod):

platform :ios, '10.0'

target 'myproject' do
  use_frameworks!

  # Pods
  pod 'Firebase/Core', '~> 6.13.0'
  pod 'Firebase/Messaging', '~> 6.13.0'

  target 'myprojectTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

post_install do |installer|
  # This fixes the problems with headers not found
  system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")
end

So far I can now successfully build from both XCode and command line.
Haven't tried making an Archive build yet though so... 馃

If you were using RN60+ and RNFB-current, you would have autolinking, no header file problems, and you could link statically if you wanted even https://rnfirebase.io/#allow-ios-static-frameworks ! (the static support in general has gotten much better in recent RN versions). I can't stress enough how important is to schedule time to do the upgrade instead of all the workarounds. The amount of bugs we've fixed is insane just at our level (RNFB), not to mention the underlying SDKs, and react-native itself. And the incompatibilities fixed for Xcode 11/12, Android 10/11, iOS 13/14...

I'm glad this seems to work for you though, good luck with your project

Was this page helpful?
0 / 5 - 0 ratings