Sandbox

I am trying to create a Game Center leaderboard for my application. I am following Apple's steps and following the sample code from GKTapper, but I cannot get any grades in Game Center. I created a leaderboard in iTunes Connect. Here is the code that reports the score:

- (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) { UIAlertView* alert= [[[UIAlertView alloc] initWithTitle: @"Score Report Failed!" message: [NSString stringWithFormat: @"Reason: %@", [error localizedDescription]] delegate: self cancelButtonTitle: @"Try Again..." otherButtonTitles: NULL] autorelease]; [alert show]; } }]; } 

The code seems to be working fine. A warning is never displayed. But, when I go to Game Center, the leaderboard is empty. I am running Xcode 4.2 and iOS 5. Any ideas?

+7
source share
5 answers

All that has been said is absolutely true:

  • you need an int_64t score;
  • you need everything configured on iTunesConnect;
  • you need to use an account for the sandbox.

I just found out that there is no such category in iTunesConnect. On the other hand, you have to run your GKScore with the leaderboard.

From what I saw on the forums, about 2/3 of people understand this correctly.

In iTunesConnect, when you set up the leaderboard, you set:

  • his link (which has long been considered a category);
  • its identifier (which is the actual category).

I tried to post an invoice using the link instead of ID.

Two things:

  • Firstly, I didnโ€™t have an error from the program (which is somewhat acceptable);
  • second, as soon as I got it right, I notice that while many people claim the opposite, there is no need for more than one sandboxed account to display ratings.
+3
source

Setting the category explicitly again after init fixed it for me.

 Scoreobject.category = category 

Also, to show the right leaderboard, I also set a category.

 leaderboardobject.category = @"mycategory"; 
+2
source

1) Check the spelling of this category. Surprisingly, I was not mistaken, even when I had the wrong spelling. Fixing this typo fixed the problem for me.

2) Please check if you configure the right Leaderboard before presenting the GKLeaderboardViewController? Install it correctly as shown below:

 GKLeaderboardViewController *leaderboardViewController = [[[GKLeaderboardViewController alloc] init] autorelease]; leaderboardViewController.category = @"yourcategoryname"; [youviewcontroller presentModalViewController:leaderboardViewController animated: YES]; 
0
source

Two verified GameCenter users must report ratings to the leaderboard before any ratings appear in the leaderboard.

If you have only one user in your sandbox, create another one and report the rating.

If it still doesnโ€™t work, make sure you confirm the email address of both users.

0
source

The documentation for reportScoreWithCompletionHandler says:

"Your application must keep a reference to the asset under review until the reporting task is complete."

You are performing an auto implementation. Because the task completes later, the object is likely to be deleted before the operation completes.

-one
source

All Articles