gpt4 book ai didi

ios - 应用程序启动时 GIDSignIn.sharedInstance.currentUser 始终为零

转载 作者:行者123 更新时间:2023-11-30 11:06:17 24 4
gpt4 key购买 nike

我遇到了类似于 this one 的问题。基本上每次我的应用启动时,我都必须使用我的 Google 帐户登录。

然后,我有这个属性:

var isGoogleSessionOpen: Bool {
return GIDSignIn.sharedInstance().currentUser != nil
}

应用程序开始检查是否必须显示 LoginViewController 时就会调用它。

我的问题是这个调用首先总是为零,所以我每次启动应用程序时都必须登录。

另外,正如上面提到的 here ,我正在这样配置范围:

if let signIn = GIDSignIn.sharedInstance() {
signIn.scopes = ["https://www.googleapis.com/auth/plus.login","https://www.googleapis.com/auth/plus.me"]
}

请问有什么想法吗?

问候

最佳答案

应用程序启动时您需要登录。

GIDSignIn.sharedInstance().signInSilently()

关于ios - 应用程序启动时 GIDSignIn.sharedInstance.currentUser 始终为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52682431/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com