Anthony Humphreys
Anthony Humphreys

Reputation: 135

ERROR: Use of undeclared identifier 'FIRApp' AppDelegate.mm using [email protected]

My goal is to be able to upload images to firebase, but my project cant read the storage library from '@react-native-firebase/storage' I believe the issue is in my AppDelegate, because it won't configure FIREApp. I am using React Native and I know they changed how AppDelegate is written with React [email protected]. All the stack overflow posts help solve this issue when AppDelegate is written in C but not C++. For instance, my AppDelegate has #if RCT_NEW_ARCH_ENABLED rather than FB_SONARKIT_ENABLED, which is used in the older React Native Version like React [email protected].

I believe this issue is relatively new because I don't think Firebase has compensated for the new way AppDelegate is written. Maybe I'm wrong and y'all know something I don't. I have checked the FireBase GitHub repo, but still, nothing helped. I haven't coded in C++ or C in a couple of years and I am relatively new to the world of App Development. If anyone could help that would be greatly appreciated.

Also I'm 99% sure I installed Firebase storage and app correctly. https://rnfirebase.io/

AppDelegate.mm (C++)

...
#import <React/RCTAppSetupUtils.h>

#if RCT_NEW_ARCH_ENABLED
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>
#import <Firebase.h>


static NSString *const kRNConcurrentRoot = @"concurrentRoot";

@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
  RCTTurboModuleManager *_turboModuleManager;
  RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
  std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
  facebook::react::ContextContainer::Shared _contextContainer;
}
@end
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];                    ///ERROR: Use of undeclared identifier 'FIREAPP'
  RCTAppSetupPrepareApp(application);

...

Upvotes: 0

Views: 1442

Answers (1)

Anthony Humphreys
Anthony Humphreys

Reputation: 135

I switched to @react-native-firebase/[email protected] and everything worked perfectly.

Upvotes: 1

Related Questions