signInSilently()生成错误代码= -4 [英] signInSilently() generates an error code=-4
问题描述
我遇到这种情况,GIDSignIn.sharedInstance()。signInSilently()返回错误:
I'm having this case where the GIDSignIn.sharedInstance().signInSilently() is returning an error:
错误域= com.google.GIDSignIn Code = -4该操作无法完成
。(com.google.GIDSignIn错误-4。)
Error Domain=com.google.GIDSignIn Code=-4 "The operation couldn’t be completed. (com.google.GIDSignIn error -4.)"
我似乎无法在google登录文档或stackOverflow下找到此错误的任何文档。
I can't seem to find any documentation of this error under the google signin docs or stackOverflow for that matter.
我期待这个如果我请求一个没有以前signedIn用户的静默signIn,就会发生错误。
但令我惊讶的是,当我有一个用户之前签名并且我试图在几秒钟后第二次无声地登录时,它甚至会发生。
I'm expecting this to error to happen if I request a silent signIn for no previously signedIn user. But to my surprise it even happens when I have a user previously signedIn and I attempt to signIn Silently a second time after a few seconds.
第二个问题我遇到的困难是确定是否有用户登录使用:
A second issue I'm having difficulty with is to determine if there is a user signed In using :
GIDSignIn.sharedInstance().currentUser
这是一个零或一个GIDGoogleUser对象。
which is either a nil or a GIDGoogleUser object.
非常感谢在这个问题上取得进展的任何帮助。
Any help making progress on this issue would be much appreciated.
谢谢
推荐答案
以下是来自 GIDSignIn.h
的错误代码。当钥匙串中没有auth令牌时, -4
代码由 signInSilently
发送。请参阅评论。
Here are the error codes from GIDSignIn.h
. The -4
code is sent by signInSilently
when there are no auth tokens in the keychain. See comments.
// 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,
};
对于谷歌SDK一般我发现头文件注释实际上是一个非常好的地方看起来,通常比任何已发布的文档更具信息性。
For the Google SDKs in general I've found the header file comments are actually a pretty good place to look, usually more informative than any published documentation.
这篇关于signInSilently()生成错误代码= -4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!