【问题标题】:Flutter Firebase AuthFlutter Firebase 身份验证
【发布时间】:2019-01-05 18:40:26
【问题描述】:

我正在开发 Flutter 应用程序,并将 Firebase 身份验证添加到项目中。 它运行良好,但是当应用程序加载控制台时会这样说。 这是正常行为吗?谢谢!

    5.4.1 - [Firebase/Core][I-COR000003]
 The default Firebase app has not yet been configured.
 Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift)
 to your application initialization.

【问题讨论】:

    标签: firebase flutter dart firebase-authentication


    【解决方案1】:

    检查configuration of IOS。然后创建一个Podfile,在该文件中添加以下库以便能够使用 Firebase 身份验证:

    pod 'Firebase/Core'
    pod 'Firebase/Auth'
    

    然后去flutterApp\ios\Runner\AppDelegate.m这个路径,导入并配置firebase:

    #include "AppDelegate.h"
    #include "GeneratedPluginRegistrant.h"
    
    @import Firebase; // new
    
    @implementation AppDelegate
    
    
    - (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    //configure firebase
    [FIRApp configure]; // new
    
    [GeneratedPluginRegistrant registerWithRegistry:self];
    // Override point for customization after application launch.
    return [super application:application didFinishLaunchingWithOptions:launchOptions];
    
      }
    
    @end
    

    【讨论】:

    • 谢谢彼得,但即使我在 Flutter 中获得了 firebase 包,我是否必须执行此步骤?
    • 是的,你也需要为IOS配置它,你在ios部分有GoogleService-Info.plist吗?
    • 哦,我不知道,非常感谢!是的,我在 Runner 子文件夹中有那个。
    • 好的,请到这个路径flutterAppName\ios\Runner\AppDelegate.m 导入并配置firebase
    • @PeterHaddad 我想知道您是如何想出使用 ios 文档将其实现为颤振的?它没有写在任何其他文档中。此解决方案有助于解决问题的错误,但我的项目中仍然存在 google 登录错误。要使用 firebase ios 文档安装 google 登录 -- firebase.google.com/docs/auth/ios/google-signin -- 是一个繁琐的项目,需要 Objective-c 的中级技能 -- 只能使用颤振。你知道怎么做吗?
    【解决方案2】:

    我在使用 firebase 时遇到过类似的问题,结果我没有在 iOS 模块的 Info.plist 中包含配置

    【讨论】:

      猜你喜欢
      • 2022-01-11
      • 2021-06-10
      • 2021-12-09
      • 2021-04-21
      • 2020-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-05
      相关资源
      最近更新 更多