将Firebase数据库添加到iOS部件时出现问题

将Firebase数据库添加到iOS部件时出现问题,ios,firebase,firebase-realtime-database,flutter,Ios,Firebase,Firebase Realtime Database,Flutter,我正试图让flatterfire数据库在我的应用程序的iOS部分工作(它在Android上运行良好),但我收到一些错误消息,说我的GoogleService Info.plist文件找不到。但我非常确定它在我的项目中的位置是正确的。 这是控制台输出: [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your applicatio

我正试图让
flatterfire数据库
在我的应用程序的iOS部分工作(它在Android上运行良好),但我收到一些错误消息,说我的
GoogleService Info.plist
文件找不到。但我非常确定它在我的项目中的位置是正确的。
这是控制台输出:

[Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization. Read more: https://firebase.google.com/docs/ios/setup#initialize_firebase_in_your_app.
[Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
[Firebase/Core][I-COR000005] No app has been configured yet.
*** Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp configure] could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x000000010ccad34b __exceptionPreprocess + 171
        1   libobjc.A.dylib                     0x000000010c70e21e objc_exception_throw + 48
        2   CoreFoundation                      0x000000010cd16265 +[NSException raise:format:] + 197
        3   Runner                              0x0000000109bdeb67 +[FIRApp configure] + 353
        4   Runner                              0x0000000109b79979 -[FirebaseDatabasePlugin init] + 185
        5   Runner                              0x0000000109b79838 +[FirebaseDatabasePlugin registerWithRegistrar:] + 168
        6   Runner                              0x0000000109b765e9 +[GeneratedPluginRegistrant registerWithRegistry:] + 121
        7   Runner                              0x0000000109b76473 -[AppDelegate application:didFinishLaunchingWithOptions:] + 99
        8   UIKit                               0x000000010d0c70be -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290
        9   UIKit                               0x000000010d0c8a43 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236
        10  UIKit                               0x000000010d0cede9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
        11  UIKit                               0x000000010d0cbf69 -[UIApplication workspaceDidEndTransaction:] + 188
        12  FrontBoardServices                  0x0000000110fd4723 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
        13  FrontBoardServices                  0x0000000110fd459c -[FBSSerialQueue _performNext] + 189
        14  FrontBoardServices                  0x0000000110fd4925 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
        15  CoreFoundation                      0x000000010cc52311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
        16  CoreFoundation                      0x000000010cc3759c __CFRunLoopDoSources0 + 556
        17  CoreFoundation                      0x000000010cc36a86 __CFRunLoopRun + 918
        18  CoreFoundation                      0x000000010cc36494 CFRunLoopRunSpecific + 420
        19  UIKit                               0x000000010d0ca7e6 -[UIApplication _run] + 434
        20  UIKit                               0x000000010d0d0964 UIApplicationMain + 159
        21  Runner                              0x0000000109b7654f main + 111
        22  libdyld.dylib                       0x000000010ea9d68d start + 1
        23  ???                                 0x0000000000000008 0x0 + 8
    )
这是我的项目树的截图:


我正在GeoFire插件示例文件夹中尝试这一点,可以在这里找到:我很想知道你们是否有更多的运气,当然还有一个可能的解决方案

好吧,我找到了解决办法! 显然,Xcode 9没有将文件添加到实际项目中

  • 这可以通过点击
    GoogleServices info.plist
    文件来解决
  • 在“目标成员资格”选项卡中检查
    Runner
    项目

  • 在第一条错误消息引用时,您是否调用了configure函数?没有,应该在哪里调用?我只是在使用
    flatterfire
    插件,并认为在Android上运行的Dart代码会在iOS上运行。我不熟悉flatterfire,但在配置仅使用Firebase的项目时,总是要求我调用
    FirebaseApp.configure()
    。最好把它放在
    AppDelegate
    didfishLaunching
    中。我甚至不能在
    AppDelegate.m
    文件中导入
    Firebase
    !我迷路了…”“在项目中找不到有效的GoogleService-Info.plist”请确保从Firebase控制台下载
    GoogleService-Info.plist
    ,并将其添加到项目中的正确位置。请看图片