代码之家  ›  专栏  ›  技术社区  ›  VK321

react native[[DEFAULT]]firebaseapp未初始化react native firebase

  •  2
  • VK321  · 技术社区  · 8 年前

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

    enter image description here

    步骤1:创建基本应用程序

    react-native init myFirebaseApp
    

    已移至项目

    cd myFirebaseApp
    

    npm install --save react-native-firebase
    

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

    复制

    谷歌服务-信息列表

    在项目中,那么

    pod init
    

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

    已安装的依赖项

    pod install
    

    最后是链接库

    react-native link
    

    1 回复  |  直到 8 年前
        1
  •  4
  •   Abdulla    7 年前

    修改您的 AppDelegate.h AppDelegate.m

    加上这个,

    #import <Firebase.h>
    

    而且在 添加 [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