2011-06-24 21 views
2

サンドボックスの更新に時間がかかっているか、コードがファンキーなのかどうかはわかりません。GK掲示板掲示の問題

私は単に最後にスコアを入力したローカルプレーヤーをつかんで別のスコアを追加し、結果を投稿しようとしています。任意の助け

- (void) reportScore: (int64_t) score forCategory: (NSString*) category 
{ 
GKScore *scoreReporter = [[[GKScore alloc]initWithCategory:category] autorelease]; 
scoreReporter.value = score; 

[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) { 
    if (error != nil) 
    { 
     // handle the reporting error 
     NSLog(@"Error reporting score"); 

    } 
}]; 
} 

-(void)postScore:(int64_t)score forCategory:(NSString *)category { 

GKLeaderboard *query = [[GKLeaderboard alloc]init]; 
query.category = category; 

if (query != nil) 

{ 

    [query loadScoresWithCompletionHandler: ^(NSArray *scores, NSError *error) { 

     if (error != nil){ 

      // Handle the error. 
      NSLog(@"Error loading scores"); 

     } 
     if (scores != nil){ 

      // Process the score. 

      int64_t newScore = query.localPlayerScore.value + score; 

      [self reportScore:newScore forCategory:category]; 


     } 



    }]; 


} 

[query release]; 
} 

ありがとう:

は、ここに私のコードです。

EDIT:サンドボックスリーダーボードは最初のスコアを持ちますが、それ以降のスコアは更新されません。

答えて

0

あなたはGKleaderBoardクラスのプロパティをチェックする必要があります。下記のコードを参照してください。

GKLeaderViewViewController * leaderController = [[GKLeaderboardViewController alloc] init];

 if (leaderboardController != NULL) 
    { 
     leaderController.category = self.currentLeaderBoard; 
     leaderController.timeScope = GKLeaderboardTimeScopeWeek; 
     leaderController.leaderboardDelegate = self; 
     [self presentModalViewController: leaderController animated: YES]; 
    } 

           AND 

下記のGKLeaderBoardとGKAchievementViewControllerクラスのAppleのドキュメントを確認することもできます。 GKAchievementViewController http://developer.apple.com/library/ios/#documentation/GameKit/Reference/GKAchievementViewController_Ref/Reference/Reference.html

ため

GKLeaderBoardため http://developer.apple.com/library/ios/#documentation/GameKit/Reference/GKLeaderboard_Ref/Reference/Reference.html

1

私の最後に同じ問題があります。それは、セッションで最初に正確にスコアを提供します。その後、同じセッションでスコアを更新しても同じスコアを返信し続けます。

関連する問題