Garrett
Garrett

Reputation: 1808

Firebase Auth causing Flutter app to crash

I've just started a new Flutter app, so nothing has really bee done yet. I added firebase_core: to my pubspec.yaml file, no errors and the app starts up fine. when I add firebase_auth: it gives me this error:

Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Xcode build done.                                           21.9s
    path: satisfied (Path is satisfied), interface: en0
Configuring the default Firebase app...
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23e3dcce __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff50b3b9b2 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff23e3db0c +[NSException raise:format:] + 188
    3   Runner                              0x0000000109e60912 +[FIRApp configure] + 130
    4   Runner                              0x0000000109f2fcd9 -[FLTFirebaseAuthPlugin init] + 217
    5   Runner                              0x0000000109f2fa9b +[FLTFirebaseAuthPlugin registerWithRegistrar:] + 171
    6   Runner                              0x0000000109dfbc13 +[GeneratedPluginRegistrant registerWithRegistry:] + 115
    7   Runner                            <…>
Exited

I've gotten it to this point and having a number of other issues with this package. What is happening?

Upvotes: 3

Views: 2288

Answers (3)

Paras Rai
Paras Rai

Reputation: 182

In my case, I was using google signin with background service in my flutter app. On initializing background service before google signin was crashing my app and doing google signin before initializing background service was fine. If anyone using both together do consider this.

Upvotes: 1

arthankamal
arthankamal

Reputation: 6413

If you've added firebase packages to flutter project, you should add GoogleService-Info.plist which you downloaded from firebase console to your Xcode project. Also make sure, your bundle id (com.companyname.appname) and your firebase iOS project bundle id are same.

Plase check this link for firebase flutter setup: https://firebase.google.com/docs/flutter/setup

Upvotes: 0

Jakob K&#252;hne
Jakob K&#252;hne

Reputation: 1015

I think you forgot the last (7) Step here: https://pub.dev/packages/google_sign_in#ios-integration

You have to add the CFBundleTypeRoles in Info.plist for every signin method. This example here is for Google Sign In.

<!-- Put me in the [my_project]/ios/Runner/Info.plist file -->
<!-- Google Sign-in Section -->
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <!-- TODO Replace this value: -->
            <!-- Copied from GoogleService-Info.plist key REVERSED_CLIENT_ID -->
            <string>com.googleusercontent.apps.861823949799-vc35cprkp249096uujjn0vvnmcvjppkn</string>
        </array>
    </dict>
</array>
<!-- End of the Google Sign-in Section -->

Change the REVERSED_CLIENT_ID with that one from your GoogleService-Info.plist

I home this helps you. I had the same error and this was the fix.

Upvotes: 1

Related Questions