0
itunes-connect를 통해 3 ~ 4 명의 테스트 사용자를 생성하여 리더 보드 구현이 올바르게 작동하는지 확인했습니다. 그래서 한 대의 기기에서 2-3 개의 다른 계정으로 게임을했습니다. 그러나 계정으로 로그인하고 점수를 신고 할 때마다 리더 보드에서 점수 만 표시되며 그 점수는 유일한 참가자입니다. 예상했는지 또는 내가 신고 한 모든 계정이 리더 보드에 있어야합니까?다른 테스트 사용자가있는 iOS 테니스 게임 센터 리더 보드
#pragma mark leaderboard
- (void)authenticateLocalPlayer {
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){
if (viewController != nil) {
[self presentViewController:viewController animated:YES completion:nil];
}
else{
if ([GKLocalPlayer localPlayer].authenticated) {
_gameCenterEnabled = YES;
// Get the default leaderboard identifier.
[[GKLocalPlayer localPlayer] loadDefaultLeaderboardIdentifierWithCompletionHandler:^(NSString *leaderboardIdentifier, NSError *error) {
if (error != nil) {
NSLog(@"%@", [error localizedDescription]);
}
else{
_leaderboardIdentifier = leaderboardIdentifier;
}
}];
}
else{
_gameCenterEnabled = NO;
}
}
};
}
- (void)reportScore:(NSNotification *) notification {
NSDictionary *userInfo = notification.userInfo;
NSNumber *score = [userInfo objectForKey:@"highestScore"];
GKScore *gkscore = [[GKScore alloc]initWithLeaderboardIdentifier:_leaderboardIdentifier];
gkscore.value = [score integerValue];
[GKScore reportScores:@[gkscore] withCompletionHandler:^(NSError *error) {
if (error != nil) {
NSLog(@"%@", [error localizedDescription]);
}
}];
}
- (void)showLeaderboard{
GKGameCenterViewController *gcViewController = [[GKGameCenterViewController alloc] init];
gcViewController.gameCenterDelegate = self;
gcViewController.viewState = GKGameCenterViewControllerStateLeaderboards;
gcViewController.leaderboardIdentifier = _leaderboardIdentifier;
[self presentViewController:gcViewController animated:YES completion:nil];
}
- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController
{
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
}
이것은 내 프로젝트에서 내 리더 보드를 구현 한 것입니다.