How to fix iOS crash during the start Firebase configure in Flutter?

Myat Min Lu
VECTOR.com.mm
Published in
2 min readApr 20, 2020

If you see this kind of error log, read continue

Logs

Launching lib/main.dart on iPhone X in debug mode...
Running Xcode clean... 1.1s
Starting Xcode build...
├─Assembling Flutter resources... 1.7s
└─Compiling, linking and signing... 7.8s
Xcode build done. 15.4s
4.13.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.
*** First throw call stack:
(
0 CoreFoundation 0x0000000106a3c1e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x00000001060d1031 objc_exception_throw + 48
2 CoreFoundation 0x0000000106ab1975 +[NSException raise:format:] + 197
3 Runner 0x0000000101e3336a +[FIRApp configure] + 352
4 Runner 0x0000000101eeef49 -[FLTFirebaseAnalyticsPlugin init] + 185
5 Runner 0x0000000101eeee28 +[FLTFirebaseAnalyticsPlugin registerWithRegistrar:] + 168
6 Runner 0x0000000101d9723c +[GeneratedPluginRegistrant registerWithRegistry:] + 124
7 Runner <…>

Step 1: Remove the GoogleService-Info.plist file if you have already in the project and follow all these steps. Don’t miss out.

Step 2: Open Runner.xcworkspace instead of Runner.xcodeproj in XCode, then add the file under Runner directly. (Only load the ios/Runner with Xcode). Just’s copy and paste in folder not working well.

Step 3: You need to place this code

FirebaseApp.configure()

before this one

GeneratedPluginRegistrant.register(with: self)

you will see in AddDelegate.swiftlike this.

import UIKit
import Flutter
import Firebase

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

After this, you will be fixed.

--

--

Myat Min Lu
VECTOR.com.mm

Founder of VECTOR Online Learning Platform and UI/UX Designer from Myanmar. https://vector.com.mm