【问题标题】:react native the [[DEFAULT]] firebaseapp is not initialized react-native-firebasereact native [[DEFAULT]] firebaseapp 未初始化 react-native-firebase
【发布时间】:2018-11-21 17:29:47
【问题描述】:

我正在尝试将 react-native-firebase 模块与 react native 一起使用。

我得到的错误:

我遵循的步骤:

Step1:创建基本应用程序

react-native init myFirebaseApp

移至项目

cd myFirebaseApp

已安装的模块

npm install --save react-native-firebase

第 2 步:设置 Firebase SDK (https://rnfirebase.io/docs/v4.2.x/installation/ios)

创建了 Firebase 应用并下载了适用于 iOS 的 GoogleService-Info.plist

复制

GoogleService-Info.plist

在项目中,然后

pod init

将这些行添加到 pod 文件中

  pod 'Firebase/Core'
  pod 'Firebase/Firestore'

已安装的依赖项

pod install

最后是链接库

react-native link

有人可以指导我缺少什么或做错了什么?

【问题讨论】:

标签: ios reactjs firebase react-native react-redux


【解决方案1】:

修改您的 AppDelegate.h 和 AppDelegate.m 文件

在AppDelegate.h 中添加这个,

#import <Firebase.h>

在AppDelegate.m 中添加[FIRApp configure];

#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>

@implementation AppDelegate

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure]; // <=== Add this line

  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];

  return YES;
}

@end

【讨论】:

    猜你喜欢
    • 2018-04-08
    • 2022-11-30
    • 1970-01-01
    • 2022-06-25
    • 2020-07-30
    • 2015-12-11
    • 1970-01-01
    • 2016-05-08
    • 1970-01-01
    相关资源
    最近更新 更多