react-native-firebase-analytics icon indicating copy to clipboard operation
react-native-firebase-analytics copied to clipboard

iOS build / installation error

Open edencakir opened this issue 8 years ago • 16 comments

React Native version: 0.40 Error:

/node_modules/react-native-firebase-analytics/ios/RNFIRAnalytics.h:4:9: fatal error: 'FirebaseCore/FIRApp.h' file not found
#import <FirebaseCore/FIRApp.h>
        ^
1 error generated.


** BUILD FAILED **


The following build commands failed:
	CompileC /Users/Enes/RN/Tviz/ios/build/Build/Intermediates/RNFIRAnalytics.build/Debug-iphonesimulator/RNFIRAnalytics.build/Objects-normal/x86_64/RNFIRAnalytics.o RNFIRAnalytics.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler

(1 failure)

edencakir avatar Jan 31 '17 09:01 edencakir

Check if you have react-native-firebase-analytics v2.0.0 or v3.0.0 installed. Also check if you installed Firebase Analytics through POD. Make sure you imported Firebase in AppDelegate.m @import Firebase;

damir-sirola avatar Feb 03 '17 13:02 damir-sirola

I have same issue. I'll try @damir-sirola suggestion. Anyway, I'm curious why no mention in readme to install react-native-firebase-analytics

pewh avatar Feb 11 '17 16:02 pewh

I also have this issue, I installed react-native-firebase-analytics also but it doesn't help me.

Phoenix-GH avatar Mar 03 '17 18:03 Phoenix-GH

I downgraded to 0.39. but using pods solved my issue (in 0.40), just type pod update few times, reset everything etc. @phoenix214

edencakir avatar Mar 03 '17 19:03 edencakir

I hit the same error. I'm on RN 0.41.2 and latest of this package.

The solution after much poking around:

@import Firebase;

at top of AppDelegate.m (as mentioned by @damir-sirola)

But also, I found I needed to comment out all the unused targets in Podfile or compiling would fail too, like so:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target '<app_name>' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for <app_name>
  pod 'Firebase/Core'

#  target '<app_name>-tvOSTests' do
#    inherit! :search_paths
#    # Pods for testing
#  end
#
#  target '<app_name>Tests' do
#    inherit! :search_paths
#    # Pods for testing
#  end

end

#target '<app_name>-tvOS' do
#  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
#  # use_frameworks!
#
#  # Pods for <app_name>-tvOS
#
#  target '<app_name>-tvOSTests' do
#    inherit! :search_paths
#    # Pods for testing
#  end
#
#end

@evollu, README can use some updating with these 2 bits for other users? Thanks for this package.

As an aside, I'm using this package in conjunction with CodePush. I'm currently stuck where building this in XCode with a Staging config (duplicate from Release), to a physical device, the build would fail. Building the same to the simulator however succeeds. Release and Debug builds to both device and simulator would succeed. Can't figure out why the Staging build to device fails.

fungilation avatar Mar 15 '17 23:03 fungilation

@fungilation it depends on how your integrate firebase with your solution @import Firebase; only works for pod integration I will update readme later

evollu avatar Mar 15 '17 23:03 evollu

use #import <Firebase/Firebase.h> instead of @import Firebase, it work for my (React-native 0.42)

Mactub07 avatar Mar 28 '17 09:03 Mactub07

@Mactub07 does not work if you're using frameworks

mienaikoe avatar Jun 03 '17 02:06 mienaikoe

I use frameworks myself I just have #import "RNFIRMessaging.h" only in my appdeletegate.m

evollu avatar Jun 03 '17 02:06 evollu

If I have use_frameworks!and that import only in my appdelegate.m, I get the FirebaseCore/FIRApp.h error noted in the first comment.

Using react-native 0.43.1

mienaikoe avatar Jun 03 '17 02:06 mienaikoe

what firebase iOS version are you using? I remember 4.0 introduced breaking change so this repo isn't compatible with that

evollu avatar Jun 03 '17 02:06 evollu

yea i saw the recent note, so am using 3.16.0

I figured it out finally. See my notes on https://github.com/evollu/react-native-fcm/issues/377, which is the same problem, but on your other package, react-native-fcm.

mienaikoe avatar Jun 03 '17 07:06 mienaikoe

Where is inherit! :search_paths?

evollu avatar Jun 03 '17 10:06 evollu

inherit! :search_paths is a directive you can use in a Podfile. another react-native module called tipsi-stripe requires it to be in your Podfile but seems to conflict with react-native-fcm. My guess is that on link time, the linker can't find the firebase headers in the Pod-provided search paths if that directive is on.

mienaikoe avatar Jun 03 '17 17:06 mienaikoe

I tried the following:

  • #import <Firebase/Firebase.h> instead of #import 'firebase.h' in my bridging header ( as I am using Swift)
  • Changed my Pod file to reference Firebase version 3.16 like below:
pod 'Firebase',  '~> 3.16', :subspecs => [
    'Analytics',
    'Messaging',
  ]
  • I do not have inherit! :search_paths in my Podfile
  • Added import Firebase to the header of my AppDelegate.swift I still get the error reported by the issue Unable to find #import <FirebaseCore/FIRApp.h> in RNFIRMessaging.h

shrutic avatar Jun 09 '17 17:06 shrutic

Any update on this issue?

agrawalsurabhi89 avatar Jan 20 '20 07:01 agrawalsurabhi89