Flutter firebase_admob 无法在 iOS 上使用默认应用程序安装

Flutter firebase_admob not working on iOS with default app install

重现步骤:

  1. create a default app in Android Studio
  2. build and run the app successfully in iOS simulator through Android Studio
  3. add dependency firebase_admob: ^0.9.0+2 in pubspec.yaml
  4. app builds successfully but crashes on startup
  5. follow instructions to add GADApplicationIdentifier with test ID code into ios/Runner/info.plist file

应用程序在启动时仍然崩溃。按照说明在 iOS 上进行设置,详见此处:https://pub.dev/packages/firebase_admob

据我所知,我已按照说明完成了所有操作,所以不知道为什么它不适用于默认应用程序。

完成上述所有步骤后我得到的错误是:

Xcode build done. 8.5s
Configuring the default Firebase app...
6.4.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
6.4.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
6.4.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
6.4.0 - [Firebase/Core][I-COR000005] No app has been configured yet.

*** First throw call stack: ( 0 CoreFoundation 0x0000000113b521bb
__exceptionPreprocess + 331 1 libobjc.A.dylib 0x00000001130f0735
objc_exception_throw + 48 2 CoreFoundation 0x0000000113b52015 +
[NSException raise:format:] + 197 3 Runner 0x000000010bd33af0 +[FIRApp
configure] + 576 4 Runner 0x000000010bd7f1c5 -[FLTFirebaseAdMobPlugin
init] + 261 5 Runner 0x000000010bd7ef2e +[FLTFirebaseAdMobPlugin
registerWithRegistrar:] + 78 6 Runner 0x000000010bd333fb +
[GeneratedPluginRegistrant registerWithRegistry:] + 123 7 Runner <…>

您需要将 GoogleService-Info.plist 从 firebase 添加到您的项目中。

检查此链接:

https://support.google.com/firebase/answer/7015592

https://firebase.google.com/docs/ios/setup

我相信 this medium post 是最全面的 ios Firebase 设置指南,但是可以跳过第 1 点 - 我有一个使用 firebase_admob 0.8.0+3 的应用程序并且它在 [=15] 下完美运行=],完成所有其他步骤后。