我正在嘗試在我的應用程式中使用谷歌登錄,但是當我按下谷歌按鈕時,應用程式崩潰了
如果有人遇到同樣的問題請幫助我很痛苦這是代碼類
class GoogleSignInProvider extends ChangeNotifier {
GoogleSignInAccount? _user;
GoogleSignInAccount get user => _user!;
Future googleSignIn(context, {bool isLoading = true}) async {
final googleSignIn = GoogleSignIn();
final googleAcount = await googleSignIn.signIn();
if (googleAcount != null) {
final googleAuth = await googleAcount.authentication;
if (googleAuth.accessToken != null && googleAuth.idToken != null) {
try {
await authInstance.signInWithCredential(
GoogleAuthProvider.credential(
idToken: googleAuth.idToken,
accessToken: googleAuth.accessToken,
),
);
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => BtmNavBarScreen(),
),
);
} on FirebaseException catch (error) {
Methods.ErrorDailog(subtitle: '${error.message}', context: context);
} catch (error) {
Methods.ErrorDailog(subtitle: '$error', context: context);
} finally {}
}
}
}
notifyListeners();
}
我認為問題出在我沒有 CFBundleURLTypes 但我不知道如何解決它我不知道將 CFBundleURLTypes 放在 info.list 中的哪個位置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Shop App</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>shop_app</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
uj5u.com熱心網友回復:
請看一下,所有標記為您必須放入的內容info.plist:
<!-- 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 -->
更多關于這里
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/522599.html
標籤:扑镖
下一篇:闡明dart中的異步操作
