GoogleSignIn().signIn() 导致 iPhone 应用程序崩溃

问题描述 投票:0回答:1

重现步骤 调用 GoogleSignIn().signIn() 函数

预期结果 打开弹出窗口,这样我就可以像在 Android 上一样登录(它在 Android 上运行完全正常,一开始在 iPhone 上也运行良好,但在某些时候它停止工作)

日志:

flutter: tried to googlesign in
Lost connection to device.
Error: Unable to terminate com.x.x on C1EA8AEA-F758-4BCD-9A9B-A4929205B2EE:
ProcessException: Process exited abnormally with exit code 3:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=3):
Simulator device failed to terminate com.x.x.
found nothing to terminate
Underlying error (domain=NSPOSIXErrorDomain, code=3):
The request to terminate "com.x.x" failed. found nothing to terminate
found nothing to terminate
  Command: /usr/bin/arch -arm64e xcrun simctl terminate C1EA8AEA-F758-4BCD-9A9B-A4929205B2EE com.x.x
the Dart compiler exited unexpectedly.

代码示例:

  Future<void> signInWithGoogle(context) async {
try {
  print("tried to googlesign in");
  final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn();
  print("passed it!");
  if (googleUser == null) return;

  final GoogleSignInAuthentication googleAuth =
      await googleUser.authentication;
  final AuthCredential credential = GoogleAuthProvider.credential(
    accessToken: googleAuth.accessToken,
    idToken: googleAuth.idToken,
  );
  await _signInWithCredential(credential);
} catch (e) {
  print(e);
  showModalBottomSheet(
    context: context,
    builder: (builder) {
      return Container(
        child: Text(e.toString()),
      );
    },
  );
}

}

flutter dart firebase-authentication google-signin
1个回答
0
投票

我今天遇到了这个问题,您必须按照以下说明相应地修改 XCode 中的 Info.plist:https://pub.dev/packages/google_sign_in_ios#ios-integration

© www.soinside.com 2019 - 2024. All rights reserved.