【问题标题】:Firebase has not been correctly initialized and the "GoogleService-Info.plist" file in the required folderFirebase 未正确初始化,所需文件夹中的“GoogleService-Info.plist”文件
【发布时间】:2021-09-04 15:41:01
【问题描述】:

我的应用在 Android 上运行正常,但在 iOS 上却出现异常。

iOS 构建是在 Codemagic 上完成的。

开发。环境 - Windows Flutter Dart。

缺少什么?

ma​​inCommon 中以下行的异常

FirebaseApp firebaseApp = await Firebase.initializeApp();

ma​​inCommon -

Future<void> mainCommon() async  {
  try {
    loggerDBND("START - MainComminStart0");
    FirebaseApp firebaseApp = await Firebase.initializeApp();

    loggerDBND("START - MainComminStart1");
    FirebaseMessaging.onBackgroundMessage(_messageHandler0);

    loggerDBND("START - MainComminStart2");
    globals.messaging = await FirebaseMessaging.instance;

    loggerDBND("START - MainComminStart3");
    globals.messaging.requestPermission();

    loggerDBND("START - MainComminStart4");
    await globals.messaging.subscribeToTopic("messaging");

    loggerDBND("START - MainComminStart5");
    globals.messaging.getToken().then((value) {
      print("Token -" + value.toString() + "-");
    });

    loggerDBND("START - MainComminStart6");


  } on Exception catch (exception) {
    loggerDBN("mainCommon - exception"+exception.toString() );
  } catch (error) {
    loggerDBN("mainCommon - error" + error.toString());
  }

例外 -

main- error[core/not-initialized] Firebase has not been correctly initialized. Have you added the "GoogleService-Info.plist" file to the project? 
    
View the iOS Installation documentation for more information: https://firebase.flutter.dev/docs/installation/ios

文件“GoogleService-Info.plist”位置 - ....\ios\Runner

【问题讨论】:

    标签: ios firebase flutter dart initialization


    【解决方案1】:

    在过去的类似问题中,解决方案是使用 Apple 的 Xcode 通过拖放文件将GoogleService-Info.plist 添加到正确的文件夹中。

    另一个用户提供了一个窗口workaround

    【讨论】:

    • 但是我没有 Xcode。 Codemagic 构建 .ipa。我使用 Windows Move 移动了文件
    • 我明白了。我添加了指向另一个答案的链接,该链接显示了可能有帮助的 windows 解决方法
    • 我打开project.pbxproj文件,没有找到GoogleService-Info.plist是不是说,plist不会在build里?
    • 我更新了文件并等待构建完成
    猜你喜欢
    • 2021-06-22
    • 2021-06-08
    • 1970-01-01
    • 1970-01-01
    • 2017-04-16
    • 1970-01-01
    • 2022-01-22
    • 1970-01-01
    相关资源
    最近更新 更多