游戏中心验证错误

发布于 2024-10-07 01:59:38 字数 693 浏览 0 评论 0原文

我试图调用游戏中心的身份验证方法,但是没有出现身份验证屏幕,并且回调返回错误:“请求的操作已被取消”。

代码:

[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error)
     {
        NSDictionary *userInfo = nil;
        if (error == nil) {

            NSLog(@"Game Center successfully authenticated");
        }
        else {
            userInfo = [NSDictionary dictionaryWithObject:error forKey:@"NSError"];
        }
        [[NSNotificationCenter defaultCenter] postNotificationName:Notification
                                                            object:self
                                                          userInfo:userInfo];

    }];

知道什么会导致这个问题吗?

I'm trying to call the authentication method of game center, however no authentication screen comes up and the callback return with an error : "the requested operation has been canceled".

The code :

[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error)
     {
        NSDictionary *userInfo = nil;
        if (error == nil) {

            NSLog(@"Game Center successfully authenticated");
        }
        else {
            userInfo = [NSDictionary dictionaryWithObject:error forKey:@"NSError"];
        }
        [[NSNotificationCenter defaultCenter] postNotificationName:Notification
                                                            object:self
                                                          userInfo:userInfo];

    }];

Any idea what can cause this issue ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦里梦着梦中梦 2024-10-14 01:59:38

在 iOS 4.2 中,当用户取消登录 Game Center 时,尝试 3 次后会返回该错误。您可以通过使用 Game Center 应用程序登录来解决该错误,然后再次尝试您的应用程序,您应该在应用程序中看到来自 Game Center 的欢迎返回消息

In iOS 4.2 when a user cancels the login to Game Center, after 3 attempts that error is returned. You can resolve the error by logging in using the Game Center app, then try your app again, you should see the welcome back message from Game Center in your app

初熏 2024-10-14 01:59:38

在测试游戏中心是否在特定设备上可用后,您应该执行类似的操作:

GKLocalPlayer *localplayer = [GKLocalPlayer localPlayer];
[localplayer authenticateWithCompletionHandler:^(NSError *error) {
    if (error) {
        //DISABLE GAME CENTER FEATURES / SINGLEPLAYER
    }
    else {
        //ENABLE GAME CENTER FEATURES / MULTIPLAYER
    }
}];

You should do something like that after you have tested if game center is available on the specific device:

GKLocalPlayer *localplayer = [GKLocalPlayer localPlayer];
[localplayer authenticateWithCompletionHandler:^(NSError *error) {
    if (error) {
        //DISABLE GAME CENTER FEATURES / SINGLEPLAYER
    }
    else {
        //ENABLE GAME CENTER FEATURES / MULTIPLAYER
    }
}];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文