evollu / react-native-firebase-analytics

React native bridge for firebase analytics
MIT License
206 stars 54 forks source link

iOS build / installation error #44

Open edencakir opened 7 years ago

edencakir commented 7 years ago

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)
damir-sirola commented 7 years ago

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;

pewh commented 7 years ago

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

Phoenix-GH commented 7 years ago

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

edencakir commented 7 years ago

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

fungilation commented 7 years ago

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.

evollu commented 7 years ago

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

Mactub07 commented 7 years ago

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

mienaikoe commented 7 years ago

@Mactub07 does not work if you're using frameworks

evollu commented 7 years ago

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

mienaikoe commented 7 years ago

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

evollu commented 7 years ago

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

mienaikoe commented 7 years ago

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.

evollu commented 7 years ago

Where is inherit! :search_paths?

mienaikoe commented 7 years ago

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.

shrutic commented 7 years ago

I tried the following:

agrawalsurabhi89 commented 4 years ago

Any update on this issue?