游戏中心支持

时间:2012-02-08 18:16:50

标签: xcode ios5 itunesconnect game-center

我想在我的应用中添加游戏中心排行榜。

在一些youtube视频和其他tut中我已经看到你需要在itunes connect中输入一个类别到排行榜。我该怎么做,因为我没有被要求这样做。

或者你能告诉我如何添加游戏中心吗?我现在做的是:

   GKScore *myScoreValue = [[GKScore alloc] initWithCategory:@"moveItQuickLeaderbord"];


    myScoreValue.value = Punkte;
    [myScoreValue reportScoreWithCompletionHandler:^(NSError *error){
        if(error != nil){
            NSLog(@"Score Submission Failed");
            NSLog([NSString stringWithFormat:@"%@", error]);



        } else {
            NSLog(@"Score Submitted");

        }

    }];

并在视图中加载:

 [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error){
    if (error ==nil) {
        NSLog(@"Success");
    } else {
        NSLog(@"Fail");
        NSLog([NSString stringWithFormat:@"%@", error]);

    }

}];

当我上传我的分数时,我总是得到分数提交的消息,但如果我查看排行榜,它不包含任何值?

1 个答案:

答案 0 :(得分:0)

如果您已注册iOS Developer计划,则应该可以访问iTunes Connect网站。在那里,您需要设置应用程序ID并激活游戏中心。之后,您可以创建排行榜并为in和其他属性输入唯一ID。