扑扑google_sign_in崩溃:__exceptionPreprocess + 294

Jos*_*dal 5 flutter

我正在flutter应用程序中使用google_sign_in插件登录。使用示例中的代码登录代码仅是:

GoogleSignIn _googleSignIn = new GoogleSignIn(
  scopes: <String>[
    'email',
    'https://www.googleapis.com/auth/spreadsheets',
    'https://www.googleapis.com/auth/drive.metadata',
  ],
);

Future<Null> _handleSignIn() async {
    print("_handleSignIn");
    try {
      await _googleSignIn.signIn();
    } catch (error) {
      print("We failed");
      print(error);
    }
  }
Run Code Online (Sandbox Code Playgroud)

这适用于Android。我按下登录按钮,然后弹出一个窗口,然后登录。

但是,这个简单的示例在iOS上崩溃了。当_handleSignIn上面的应用程序调用时,该_googleSignIn.signIn()调用使该应用程序崩溃(它消失了),并显示错误消息:

flutter: _handleSignIn
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010fe581e6 __exceptionPreprocess + 294
    1   libobjc.A.dylib                     0x000000010f4ed031 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010fecd975 +[NSException raise:format:] + 197
    3   Runner                              0x000000010ce61d8b -[GIDSignIn signInWithOptions:] + 242
    4   Runner                              0x000000010ce5e777 -[GIDSignIn signIn] + 64
    5   Runner                              0x000000010ce591b2 -[FLTGoogleSignInPlugin handleMethodCall:result:] + 2114
    6   Flutter                             0x000000010d1af716 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 118
    7   Flutter                             0x000000010d1c5370 _ZNK5shel<…>
Lost connection to device.
Run Code Online (Sandbox Code Playgroud)

我没有构建iOS应用的经验,所以我可能做错了。我按照说明进行操作,GoogleService-Info.plist从firebase.com中添加了,并Info.plist按照说明进行了更新。

有任何想法吗?有什么方法可以获取更好的错误消息,以便找出可能出了什么问题?

Far*_*rwa 9

我的情况是我更新了但忘记根据inGoogleService-Info.plist进行更新。CFBundleURLTypesREVERSED_CLIENT_IDInfo.plist


Pat*_*oos 6

只是有同样的问题。这是因为我添加了Google和Facebook登录。

解:

调整信息列表。搜索CFBundleURLTypes。您将看到两次。那是错的。从Facebook上复制<string>fb??????????????</string>一部分并将其粘贴到Google部件的同一阵列中。然后CFBundleURLTypes从Facebook部分中删除。

背景:

如果您只是按照Google登录名和Facebook登录名中的说明进行操作,则将粘贴CFBundleURLTypesGoogle的一部分和Facebook的一部分。只有后者会被接走。因此,谷歌之一不在那里。因此,当尝试使用Google登录名登录时,由于设置不正确,将引发异常。因为谷歌的URL方案被facebook之一所覆盖。

帮助我找出问题的相关问题:


Jos*_*dal 1

不确定问题是什么。我又重新做了一遍,现在可以了。也许这是一个剪切粘贴错误。

我做的唯一新事就是在“常规”选项卡中将“团队”设置为“我的个人团队”。之前是未设置的。不知道这是否重要。

设置团队