React-native-firebase: Use of undeclared identifier FIRApp while archive only.

Created on 14 Apr 2020  路  8Comments  路  Source: invertase/react-native-firebase

I am using react-native-firebase for authentication, cloud messaging, analytics, remote config, admob. I am successfully run the app in my physical device. But i got the error Use of undeclared identifier 'FIRApp' when I am trying to archieve my build..

No Template

Most helpful comment

Look at your AppDelegate file and make sure you are not placing the @import Firebase statement inside the if DEBUG clause where Flipper is. I made this mistake too.

All 8 comments

If it works in some builds (debug) but not others (release, for archive) always suspect local caching in your build toolchain that is incorrect. I use npx react-native-clean-project to purge those out, then retry. If that still doesn't work, suspect some sort of failure to upgrade correctly from one version of react-native to another

You skipped the template so I have no idea what versions you are on, so I will assume you are current. This demo proves it works, from start to finish: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh with current versions - you can clone and run it

Same issue on IOS. Working fine on simulator but when I try to build I have this error. I tried "npx react-native-clean-project", cleaning everything manually using this: https://gist.github.com/jarretmoses/c2e4786fd342b3444f3bc6beff32098d.

Closing XCode before cleaning and then try to archive again.

Any idea?

Edit: Will try the make-demo-v6.sh and update

Ok I changed:
#import <Firebase.h>
to
@import Firebase;

and put the import at the top of the AppDelegate.m file:

#import "AppDelegate.h"
@import Firebase;
...

and it's working now

@arun2791

"Same issue" - but without versions of everything in use (Xcode, the simulator, the device, react-native, react-native-firebase) could be anything.

Either way I think that's in the docs as that is how I integrated RNFBv6 for my demo, which I built off the docs https://github.com/mikehardy/rnfbdemo/blob/7cbef6e0b1dded1b732ea75e6b14d7f17ca28dcc/make-demo-v6.sh#L20

Ok I changed:
#import <Firebase.h>
to
@import Firebase;

and put the import at the top of the AppDelegate.m file:

#import "AppDelegate.h"
@import Firebase;
...

and it's working now

@arun2791

Thanks.. this one works for me

you can put it on #if DEBUG in applegate.m

Look at your AppDelegate file and make sure you are not placing the @import Firebase statement inside the if DEBUG clause where Flipper is. I made this mistake too.

Ok I changed:
#import <Firebase.h>
to
@import Firebase;

and put the import at the top of the AppDelegate.m file:

#import "AppDelegate.h"
@import Firebase;
...

and it's working now

@arun2791

Thanks brom safe my day

Was this page helpful?
0 / 5 - 0 ratings