我遇到了类似于 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/