ios - Google+ 登录崩溃

标签 ios authentication crash google-plus

应用在 G+ 登录时崩溃。

Crashlytics 报告它发生在方法中:

[GPPSignIn addSavedKeychainName:]

异常(exception)是:

Fatal Exception: NSInvalidArgumentException
[___NSArrayM insertObject:AtIndex:]: object cannot be nil

我的代码是:

- (void)googleLogin
{
    GPPSignIn *gppSignIn = [GPPSignIn sharedInstance];
    gppSignIn.clientID = GOOGLE_CLIENTID;
    gppSignIn.scopes = [NSArray arrayWithObjects:kGTLAuthScopePlusLogin, nil];
    gppSignIn.delegate = self;
    gppSignIn.shouldFetchGoogleUserEmail = YES;
    gppSignIn.attemptSSO = YES;

    [SVProgressHUD show];
    [gppSignIn authenticate];
}

有没有其他人遇到过这个问题并且知道如何解决它?

最佳答案

这可能是你调用

造成的
[gppSignIn authenticate];

相反,尝试:

[gppSignIn trySilentAuthentication];

如果您希望用户自动登录。

您可能还想尝试将范围作为字符串常量传递,以确保 kGTLAuthScopePlusLogin 值没有发生某些事情:

signIn.scopes = [NSArray arrayWithObjects:
                 @"login",
                 nil];

另请注意,当达到此状态时将用户注销可能会解决问题:

[[GPPSignIn sharedInstance] signOut];

关于ios - Google+ 登录崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23731100/

相关文章:

ios - 将 child 添加到 firebase (iOS) - 新 child 的插入不会停止

ios - 使用 swift 在大量 map 上的 xcode 中构建时间极长

ios - 在 iOS 中打印 HTML

swift - 是否可以自定义 fabric Twitter 登录按钮的大小?

python - 如何使用python(ucrtbase.DLL)解析ucrtbase.dll APPCRASH

ios - 如何从方法中启动 ViewController?

api - 如何验证用户从 Web 应用程序到 API 的身份?

c# - ASP.NET Core 2 身份验证方案

iOS 8 应用程序崩溃,应用程序在 iOS 7 上运行正常

iphone - 应用程序在模拟器上崩溃。适用于 iPhone 设备