简体   繁体   English

Firebase Auth 导致 Flutter 应用程序崩溃

[英]Firebase Auth causing Flutter app to crash

I've just started a new Flutter app, so nothing has really bee done yet.我刚刚启动了一个新的 Flutter 应用程序,所以还没有真正做任何事情。 I added firebase_core: to my pubspec.yaml file, no errors and the app starts up fine.我将 firebase_core firebase_core:添加到我的pubspec.yaml文件中,没有错误,应用程序启动正常。 when I add firebase_auth: it gives me this error:当我添加firebase_auth:它给了我这个错误:

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.我已经做到了这一点,并且这个 package 还有许多其他问题。 What is happening?怎么了?

I think you forgot the last (7) Step here: https://pub.dev/packages/google_sign_in#ios-integration我想你忘记了最后一个(7)步骤: https://pub.dev/packages/google_sign_in#ios-integration

You have to add the CFBundleTypeRoles in Info.plist for every signin method.您必须在 Info.plist 中为每个登录方法添加 CFBundleTypeRoles。 This example here is for Google Sign In.此示例适用于 Google 登录。

<!-- 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使用您的 GoogleService-Info.plist 中的那个更改 REVERSED_CLIENT_ID

I home this helps you.我家这对你有帮助。 I had the same error and this was the fix.我有同样的错误,这是修复。

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. 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.还要确保您的bundle id (com.companyname.appname)和您的firebase iOS project bundle id相同。

Plase check this link for firebase flutter setup: https://firebase.google.com/docs/flutter/setup请检查此链接以获取 firebase flutter 设置: https://firebase.google.com/docs/flutter/setup

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM