在我的 iOS 生产方案上使用
googleSignIn.signIn()
方法时,应用程序崩溃了。在我更新到 Xcode 15 后,这种情况开始发生,并且此崩溃仅发生在 iOS 17 上。
它适用于舞台方案,但不适用于制作方案。
异常日志:
flutter: The following PlatformException was thrown Main :: PlatformDispatcher:
flutter: PlatformException(google_sign_in, UIViewController is missing its initial trait collection populated
flutter: during initialization. This is a serious bug, likely caused by accessing properties or methods on
flutter: the view controller before calling a UIViewController initializer. View controller:
flutter: <SFAuthenticationViewController: 0x7fdd551c6a00>, NSInternalInconsistencyException, null)
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 GoogleSignInApi.signIn (package:google_sign_in_ios/src/messages.g.dart:237:7)
flutter: <asynchronous suspension>
flutter: #1 GoogleSignInIOS._signInUserDataFromChannelData (package:google_sign_in_ios/google_sign_in_ios.dart:99:3)
flutter: <asynchronous suspension>
flutter: #2 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:278:30)
flutter: <asynchronous suspension>
颤动医生日志:
[✓] Flutter (Channel stable, 3.16.5, on macOS 14.2.1 23C71 darwin-arm64, locale en-IN)
• Flutter version 3.16.5 on channel stable at /Users/urvesh/Work/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 78666c8dc5 (12 days ago), 2023-12-19 16:14:14 -0800
• Engine revision 3f3e560236
• Dart version 3.2.3
• DevTools version 2.28.4
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/urvesh/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C65
• CocoaPods version 1.14.3
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.85.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.80.0
[✓] Connected device (1 available)
• iPhone 15 Pro Max (mobile) • 4D4630D7-AE9D-4246-833B-DCC1D6D3A17B • ios •
com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
[✓] Network resources
• All expected network resources are available.
我尝试更新需要 flutter 升级的 google_sign_in 包,但这也不起作用,因此降级回旧的 flutter 版本 3.13.9。
检查了产品和阶段的 GoogleService-Info.plist,但所有变量/键值都是正确的
就我而言,未根据以下说明正确配置 iOS 客户端 ID:google_sign_in iOS Integration。
具体来说,我必须为我的两个方案配置正确的 iOS 客户端 ID。
有 2 个配置选项:
Info.plist
文件中GoogleSignIn