gpt4 book ai didi

authentication - 验证本地玩家 - 游戏中心 - iOS6

转载 作者:行者123 更新时间:2023-12-04 06:39:12 25 4
gpt4 key购买 nike

我对 Game Center 的开发完全陌生。我看过 WWDC 的视频,也看过开发者网站。他们建议我为 iOS 6 输入这样的代码:

- (void) authenticateLocalPlayer
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){
if (viewController != nil)
{
[self showAuthenticationDialogWhenReasonable: viewController
}
else if (localPlayer.isAuthenticated)
{
[self authenticatedPlayer: localPlayer];
}
else
{
[self disableGameCenter];
}
}];
}

我已将其复制到应用程序 delegate.m 文件中,但它不喜欢它,显示错误,例如在 [self showAuthenticationDialogWhenReasonable: viewController 之后出现 ] } 在其他人中。

谁能告诉我如何在 iOS 6 中验证游戏中心的用户身份?

最佳答案

要了解 GameKit,可以从 apple 获得示例,例如: https://developer.apple.com/library/ios/#samplecode/GKLeaderboards/Introduction/Intro.html .

在您的代码中,您缺少结尾的“]”,但是当然您需要的不仅仅是这个函数来连接到 gameCenter。最好从其中一个示例开始。

关于authentication - 验证本地玩家 - 游戏中心 - iOS6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12719217/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com