GameCenter集成并发症?

时间:2012-05-02 21:27:26

标签: iphone ios xcode game-center

我调用下面的代码在屏幕顶部弹出游戏中心用户横幅,但它说游戏中心无法识别游戏:

我将此添加到我的addDidFinishLaunching:

- (void)applicationDidFinishLaunching:(UIApplication *)application { 
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error){
if (error ==nil) {
NSLog(@"Success");
} else {
NSLog(@"Fail");
}
}];

要查看排行榜,我需要添加哪些代码才能正确调用它?

-(void)viewscores:(SPEvent*)event{
CODE HERE
 }

1 个答案:

答案 0 :(得分:1)

你可以这样试试:

GKLeaderboardViewController *leaderboardVC = [[[GKLeaderboardViewController alloc]init]autorelease];
if (leaderboardVC !=nil) {
    leaderboardVC.leaderboardDelegate = self;
    [self presentViewController:leaderboardVC];
}

我希望它有所帮助: - )