扑扑google_sign_in崩溃:__exceptionPreprocess + 294 [英] flutter google_sign_in crash : __exceptionPreprocess + 294
问题描述
我正在Flutter应用中使用 google_sign_in 插件登录.使用示例登录代码为只是:
I am using the google_sign_in plugin in a flutter app to sign in. Using code from the example The code for signing in is just:
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);
}
}
这适用于Android.我按下登录按钮,出现一个弹出窗口,然后登录.
This works on Android. I press the signin button and there is a popup and I get to signin.
但是,这个简单的示例在iOS上崩溃了.当应用程序调用上面的_handleSignIn
时,_googleSignIn.signIn()
调用使应用程序崩溃(它消失了),并显示错误消息:
But, this simple example crashes on iOS. When the app calls _handleSignIn
above, the _googleSignIn.signIn()
call crashes the app (it goes away) with the error message:
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.
我没有构建iOS应用的经验,所以我可能做错了什么.我遵循了说明,并从firebase.com添加了GoogleService-Info.plist
,并将我的Info.plist
更新为指示.
I have no experience building iOS apps so, I probably did something wrong. I followed the instructions and added the GoogleService-Info.plist
from firebase.com and updated my Info.plist
as instructed.
有什么想法吗?通过任何方式获得更好的错误消息,以便我可以找出出什么问题了?
Any ideas? Any way to get a better error message so I can figure out what might be wrong?
推荐答案
遇到了同样的问题.这是因为我添加了Google& Facebook登录.
Just had the same problem. It was because I added Google & Facebook login.
调整信息列表.搜索CFBundleURLTypes
.您将看到两次.那是错的.从Facebook上复制<string>fb??????????????</string>
部分,并将其粘贴到Google部分的同一数组中.然后从Facebook部分中删除CFBundleURLTypes
.
Adjust Info.plist. Search for CFBundleURLTypes
. You will see you have it TWICE. That is wrong. From the Facebook one, copy the <string>fb??????????????</string>
part and paste it into the same array in the Google Part. Then remove the CFBundleURLTypes
from the Facebook part.
如果您只是按照Google Login&中的说明进行操作, Facebook登录名,然后您将为Google粘贴一个CFBundleURLTypes
部分,为Facebook粘贴一个.只有后者会被接走.因此,谷歌之一不在那里.因此,当尝试使用Google登录名登录时,由于设置不正确,将引发异常.因为google网址方案已被facebook覆盖.
If you just follow the instructions from Google Login & Facebook login, then you will paste a CFBundleURLTypes
section for Google and one for Facebook. Only the latter one will be picked up. So the google one is not in there. So when trying to log in with google sign in, it will raise the exception because it is not correctly setup. Because the google url scheme got overwritten with the facebook one.
帮助我弄清问题的相关问题:
Related issues that helped me figure out the problem:
- App getting crash when click on GoogleSignIn button
- https://github.com/googlesamples/google-services/issues/81
这篇关于扑扑google_sign_in崩溃:__exceptionPreprocess + 294的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!