【发布时间】:2020-08-13 01:04:26
【问题描述】:
我第一次尝试在 iOS (iPhone 8) 模拟器上使用命令 flutter clean 和 flutter run 运行 Flutter 应用程序。我收到以下错误:
Configuring the default Firebase app...
Configured the default Firebase app __FIRAPP_DEFAULT.
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e39f0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ad79b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e39d4c +[NSException raise:format:] + 188
3 Runner 0x0000000106f1d519 +[FIRApp appWasConfiguredTwice:usingOptions:] + 185
4 Runner 0x0000000106f1cf92 +[FIRApp configureWithName:options:] + 306
5 Runner 0x0000000106f1cd1f +[FIRApp configureWithOptions:] + 143
6 Runner 0x0000000106f1cc6d +[FIRApp configure] + 157
7 Runner 0x0000000106eb81a4 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 212
8 Runner <…>
This is taking longer than expected...
所以我怀疑该错误与我的“Firebase”依赖项有关。
1) 我的 podfile 如下:
pod 'Flutter', :path => 'Flutter'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
2) 我确实看到我的 GoogleService-Info.plist 位于 /ios/Runner 下。
3) 我的AppDelegate.swfit如下:
import UIKit
import Flutter
import Firebase
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
FirebaseApp.configure()
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
我应该如何解决这个问题?
【问题讨论】: