ios – signInSilently()生成错误代码= -4

我遇到这种情况,GIDSignIn.sharedInstance().signInSilently()返回错误:

Error Domain=com.google.GIDSignIn Code=-4 “The operation couldn’t be
completed. (com.google.GIDSignIn error -4.)”

我似乎没有找到任何关于这个错误的文档在谷歌登录文件或stackOverflow的事情.

如果我以前没有签署过匿名用户请求一个无声的signIn,我希望这样会发生错误.
但令我惊讶的是,当我有一个用户以前签署了,我尝试在几秒钟后第二次静默登录.

我遇到的第二个问题是确定是否有用户登录使用:

GIDSignIn.sharedInstance().currentUser

它是一个零或一个GIDGoogleUser对象.

在这个问题上取得进展的任何帮助将不胜感激.

谢谢

解决方法

以下是GIDSignIn.h的错误代码.当钥匙扣中没有授权令牌时,-4代码将被signInSilently发送.看评论.
// A list of potential error codes returned from the Google Identity SDK.
typedef NS_ENUM(NSInteger,GIDSignInErrorCode) {
  // Indicates an unknown error has occured.
  kGIDSignInErrorCodeUnknown = -1,// Indicates a problem reading or writing to the application keychain.
  kGIDSignInErrorCodeKeychain = -2,// Indicates no appropriate applications are installed on the user's device which can handle
  // sign-in. This code will only ever be returned if using webview and switching to browser have
  // both been disabled.
  kGIDSignInErrorCodeNoSignInHandlersInstalled = -3,// Indicates there are no auth tokens in the keychain. This error code will be returned by
  // signInSilently if the user has never signed in before with the given scopes,or if they have
  // since signed out.
  kGIDSignInErrorCodeHasNoAuthInKeychain = -4,// Indicates the user canceled the sign in request.
  kGIDSignInErrorCodeCanceled = -5,};

对于一般的Google SDK,我发现头文件的注释实际上是一个很好的地方,通常比任何发布的文档都更丰富.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...