首次取消后,游戏中心登录对话框不再显示(iOS7) [英] Game Center login dialog not shown again after cancelling it for the first time (iOS7)

查看:87
本文介绍了首次取消后,游戏中心登录对话框不再显示(iOS7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将用户登录到游戏中心时遇到问题。我首先在应用程序完成加载后立即显示
登录对话框。如果用户取消
对话框,我想通过在主菜单中提供
登录按钮给他改变主意的选项。但是,在iOS7的iPad上,该按钮不会产生
任何东西 - 游戏中心对话框没有显示(它在
iOS6上正常工作)。相反,我立即得到错误请求的操作已由用户取消或禁用
。在应用程序启动
和按钮点击时调用相同的代码。它使用authenticateWithCompletionHandler方法,
基本上看起来像:

I have a problem with logging a user to the Game Center. I first present the login dialog right after the application finishes loading. If the user cancels the dialog, I want to give him the option to change his mind by providing a login button in my main menu. However, on iPads with iOS7, the button doesn't do anything - the Game Center dialog doesn't get shown (it works correctly on iOS6). Instead, I immediately get the error "The requested operation has been cancelled or disabled by the user." Same code is called on application launch and on the button tap. It uses the authenticateWithCompletionHandler method and basically looks like:

GKLocalPlayer* localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error)
{
    OnLogin(error);
}];

(我知道这个方法已被弃用,但我对新方法的体验是
更糟糕的是。

(I know the method is deprecated, but my experience with the new one has been even worse).

有趣的是,如果我将
应用程序移动到后台并将其恢复到前台,则会出现GC对话框。

The interesting thing is that the GC dialog DOES appear if I move the application to the background and then bring it back to the foreground.

我描述的问题即使在第一次取消后也会发生,所以我认为
与Game Center在3次取消后禁止申请有任何关系。

The issue I describe happens even after the first cancel, so I don't think it has anything to do with Game Center banning applications after 3 cancels.

有谁知道如何解决这个问题?

Does anyone know how to fix this?

推荐答案

关于在您的评论中,我发现Apple文档提到Game Kit的政策是在用户取消登录一次后不要求用户再次登录。

In regards to your comment, I found the Apple documentation that mentions Game Kit's policy of not asking a user to login again after they have cancelled login once.

它位于游戏中心编程指南 使用玩家时的常见任务 > 在设备上验证本地播放器。 (粗体类型是我的)

It's in the Game Center Programming Guide under Common Tasks When Working with Players > Authenticating a Local Player on the Device. (bold type is mine)


重要提示:Game Kit处理所有支持Game Center的游戏选择退出游戏中心。 如果玩家已拒绝创建帐户,则当您的游戏对玩家进行身份验证时,会告知玩家没有经过身份验证的玩家。玩家永远不会看到身份验证对话框。由于Game Kit会在所有游戏中处理此过程,因此您的游戏不应包含自己的机制来禁用Game Center身份验证或要求玩家进行身份验证。相反,您的游戏应该在每次启动时简单地验证播放器,并在验证完成时进行适当的响应。

Important: Game Kit handles opting out of Game Center across all games that support Game Center. If a player has already declined to create an account, when your game authenticates the player, it is told there is no authenticated player. The player never sees an authentication dialog. Because Game Kit handles this process across all games, your game should not include its own mechanism to disable Game Center authentication or ask a player’s permission to authenticate. Instead, your game should simply authenticate the player every time it launches and respond appropriately when authentication completes.

您可以通过包含验证处理程序中的 NSLog ,用于显示每次调用处理程序以及它是成功还是失败。希望这会有所帮助......

You can confirm this by including an NSLog in the authentication handler to show each time the handler is called and whether it succeeded or failed. Hope this helps...

这篇关于首次取消后,游戏中心登录对话框不再显示(iOS7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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