Google Play游戏服务iOS登录失败 [英] Google Play Game Services iOS crash on sign in

查看:207
本文介绍了Google Play游戏服务iOS登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次进入xcode和objective-c的世界,所以请耐心等待。我一直在遵循google开发者网站上列出的在ios上实施google play游戏服务的步骤:
https://developers.google.com/games/services/ios/quickstart



步骤1-7工作正常,能够使用GPSignIn对象登录到Google+: b
$ b


用auth完成。 2013-05-28 02:37:19.718 MyApp [2012:907]成功
登录Google! Auth对象是GTMOAuth2Authentication
0x1d56ab40:
{accessToken =ya29.AHES6ZQa59aGdKmrWhKSN0ie_S_CqgLfBqKzlmHXU0Cpnxs,
refreshToken =1 / A8dCPhVKRRgbsM4Gcp4qlkhNJc9SyyTUEVssN3A-Iro,
expirationDate =2013-05-28 10 :37:19 +0000}

一旦我实现了第8步,虽然在GPGManager signIn函数中似乎有崩溃,已经实现如下:

   - (void)startGoogleGamesSignIn 
{
// GPPSignIn对象有一个auth令牌现在。将其传递给GPGManager。
[[GPGManager sharedInstance] signIn:[GPPSignIn sharedInstance]
reauthorizeHandler:^(BOOL requiresKeychainWipe,NSError * error){
//如果您点击此项,auth失败,您需要进行身份验证。
//最有可能在后台刷新
if(requiresKeychainWipe){
[[GPPSignIn sharedInstance] signOut];
}
[[GPPSignIn sharedInstance] authenticate];
}];

调试日志:

< blockquote>

013-05-28 02:16:04.742 MyApp [1970:907]打印gppsignin实例
= 2013-05-28 02:16:04.781 MyApp [1970:907]打印gpgmanager实例= 2013-05-28
02:16:04.785 MyApp [1970:907] *由于未被捕获的
异常'NSInvalidArgumentException'终止应用程序,原因:'*

- [__ NSPlaceholderArray initWithObjects:count:]:尝试从对象[0]中插入nil对象[0]'
* em * * 0x37bd1 0x36331 0xb27f 0xb10b
0x2edcd 0x108d7 0x340986fd 0x33fd81f9 0x33fd8115 0x3343a45f 0x33439b43
0x33461fcb 0x336a374d 0x3346242b 0x333c603d 0x33732683 0x33731ee9
0x33730cb7 0x336a3ebd 0x336a3d49 0x372562eb 0x355b9301 0xab3d
0x3b812b20)的libc ++ abi.dylib:终止叫抛出一个例外
(lldb)

据我所知,我在代码中没有使用任何NSArrays,我无法获得正确的调用堆栈。有没有其他人在玩这个类似的问题?

解决方案

官方文档并没有把这个区别弄清楚: PlayGameServices.framework 必须添加到链接二进制文件库构建阶段 PlayGameServices .bundle 必须添加到复制包资源构建阶段。



PS:感谢farroid指出问题的原因。


This is my first foray into the world of xcode and objective-c so please bear with me. I've been following the steps listed on the google developer site for implementing google play games services on ios: https://developers.google.com/games/services/ios/quickstart

Steps 1-7 work fine and I'm able to sign in to Google+ using the GPSignIn object:

Finished with auth. 2013-05-28 02:37:19.718 MyApp[2012:907] Success signing in to Google! Auth object is GTMOAuth2Authentication 0x1d56ab40: {accessToken="ya29.AHES6ZQa59aGdKmrWhKSN0ie_S_CqgLfBqKzlmHXU0Cpnxs", refreshToken="1/A8dCPhVKRRgbsM4Gcp4qlkhNJc9SyyTUEVssN3A-Iro", expirationDate="2013-05-28 10:37:19 +0000"}

Once I implement step 8 though there seems to be a crash in the GPGManager signIn function which I have implemented like so:

-(void)startGoogleGamesSignIn
    {
      // The GPPSignIn object has an auth token now. Pass it to the GPGManager.
      [[GPGManager sharedInstance] signIn:[GPPSignIn sharedInstance]
           reauthorizeHandler:^(BOOL requiresKeychainWipe, NSError *error) {
             // If you hit this, auth has failed and you need to authenticate.
             // Most likely you can refresh behind the scenes
             if (requiresKeychainWipe) {
               [[GPPSignIn sharedInstance] signOut];
             }
             [[GPPSignIn sharedInstance] authenticate];
           }];
    }

Debug log:

013-05-28 02:16:04.742 MyApp[1970:907] Printing the gppsignin instance = 2013-05-28 02:16:04.781 MyApp[1970:907] Printing the gpgmanager instance = 2013-05-28 02:16:04.785 MyApp[1970:907] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' * First throw call stack: (0x3375d2a3 0x3b3db97f 0x336a734d 0x336a7a79 0x57089 0x56bf5 0x57f2d 0x37bd1 0x36331 0xb27f 0xb10b 0x2edcd 0x108d7 0x340986fd 0x33fd81f9 0x33fd8115 0x3343a45f 0x33439b43 0x33461fcb 0x336a374d 0x3346242b 0x333c603d 0x33732683 0x33731ee9 0x33730cb7 0x336a3ebd 0x336a3d49 0x372562eb 0x355b9301 0xab3d 0x3b812b20) libc++abi.dylib: terminate called throwing an exception (lldb)

As far as I can tell I'm not using any NSArrays in my code and I can't get a proper callstack. Is anyone else playing around with this getting similar issues?

解决方案

The official documentation doesn't make this distinction clear enough: unlike the PlayGameServices.framework which has to be added to the Link Binary With Libraries build phase the PlayGameServices.bundle has to be added to the Copy Bundle Resources build phase.

PS: Thanks to farroid for pointing out the cause of the problem.

这篇关于Google Play游戏服务iOS登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆