我正在将游戏中心集成到cocos2d项目上。
GKLeaderboardViewController* leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != nil){
NSLog(@"view make");
leaderboardController.leaderboardDelegate = self;
leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
leaderboardController.category = @"myGameBoard";
[[CCDirector sharedDirector] presentViewController: leaderboardController animated: YES completion:nil];
show popup
Game Center unavailable
Player is not signed in
并没有出现排行榜。
我的条件
1)testuser看起来成功登陆
此消息出现在屏幕上。
Welcome back testuser
*** sandbox ***
2)然后出现此消息
Game Center unavailable
Player is not signed in
3)应用程序上传已准备就绪并通过组织者验证
4)iTunes上的应用版本连接和本地是相同的1.00
5)在iTunes上捆绑Idenfier连接和本地是相同的
6)leaderboardController.category名称'myGameBoard'已正确设置。
我还需要调查吗?
答案 0 :(得分:3)
我用这种方式解决了 TEST MODE 这个问题:
我希望它适用于所有人
答案 1 :(得分:1)
我通过确保本地用户经过身份验证并登录来解决了这个问题:
- (void) authenticateLocalUser
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
if (![localPlayer isAuthenticated])
{
[localPlayer setAuthenticateHandler:(^(UIViewController* viewcontroller, NSError *error) {
if (!error && viewcontroller)
{
AppDelegate *appDelegate = (AppDelegate*) [[UIApplication sharedApplication] delegate];
UIViewController *currentViewController = [[appDelegate window] rootViewController];
[currentViewController presentViewController:viewcontroller animated:YES completion:nil];
}
})];
}
}