我一直在寻找一些类似主题的答案,但我找不到适合我的问题的答案。
我在 viewDidLoad 中有这个
self.currentLeaderBoard = [leaderboards objectForKey:[defaults objectForKey:@"Level"]];
if ([GameCenterManager isGameCenterAvailable]) {
self.gameCenterManager= [[GameCenterManager alloc] init];
[self.gameCenterManager setDelegate: self];
[self.gameCenterManager authenticateLocalUser];
} else {
NSLog(@"Current device doesn't support GameCenter");
}
我尝试以这种方式发送分数:
NSLog(@"Category %@", self.currentLeaderBoard);
[self.gameCenterManager reportScore: 20 forCategory: self.currentLeaderBoard];
[self.gameCenterManager reloadHighScoresForCategory: self.currentLeaderBoard];
我也添加了这个来修复,但它没有帮助:
- (void) processGameCenterAuth: (NSError*) error
{
if(error == NULL)
{
[self.gameCenterManager reloadHighScoresForCategory: self.currentLeaderBoard];
NSLog(@"GAMECENTER OK");
}
else
{
UIAlertView* alert= [[UIAlertView alloc] initWithTitle: @"Game Center Account Required"
message: [NSString stringWithFormat: @"Reason: %@", [error localizedDescription]]
delegate: self cancelButtonTitle: @"Try Again..." otherButtonTitles: NULL];
[alert show];
}
}
但效果总是一样的:
2012-04-15 11:34:31.987 Colors[40146:1bb03] authenticateWithCompletionHandler: enter
2012-04-15 11:34:32.009 Colors[40146:1bb03] authenticateWithCompletionHandler: exit
2012-04-15 11:34:32.010 Colors[40146:1bb03] NORMAL MODE
2012-04-15 11:34:33.163 Colors[40146:1bb03] GAMECENTER OK
2012-04-15 11:34:33.368 Colors[40146:1bb03] Missed Method
2012-04-15 11:34:33.773 Colors[40146:1bb03] Category 2
2012-04-15 11:34:33.851 Colors[40146:1bb03] Missed Method
2012-04-15 11:34:33.989 Colors[40146:1bb03] Missed Method
正如您所看到的,它在应用程序开始运行时以及当我尝试报告分数时显示“Missed Method”。它根本不报告分数(我在模拟器上尝试了 2 个不同的帐户) - GC 中没有显示任何内容。当然,我检查了在 iTunes Connect 中是否正确设置了类别,并且它们似乎是正确的。 http://cl.ly/183a2A2p1M0A2k2c3U2B
请告诉我我做错了什么以及如何解决它......谢谢!