登录时,Google Play游戏服务iOS崩溃

时间:2013-05-28 21:47:21

标签: ios google-play-services

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

步骤1-7工作正常,我可以使用GPSignIn对象登录Google+:

  

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

一旦我实现了第8步,虽然GPGManager signIn函数似乎出现了崩溃,我已经这样实现了:

-(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];
           }];
    }

调试日志:

  

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对象    * 第一次抛出调用堆栈:(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调用抛出异常   (LLDB)

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

3 个答案:

答案 0 :(得分:1)

因为您忘记在xcode项目中添加PlayGameServices.bundle,如https://developers.google.com/games/services/ios/quickstart上的入门指南

资料来源:我有同样的问题。

答案 1 :(得分:1)

官方文档没有明确区分这一点:与必须添加到PlayGameServices.framework构建阶段的Link Binary With Libraries不同,PlayGameServices.bundle必须添加到Copy Bundle Resources 1}}构建阶段。

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

答案 2 :(得分:0)

添加所有异常断点,然后在遇到断点时,可以使用控制台上的image lookup --address和跟踪文本中的地址来查找问题所在。当你把它交给GPP课程时,你认为存在的东西很可能是零。