IOS Sandbox Game Center: Leadership Shows Show "Unrated"

So, I am sending grades to the GC Leaderboards, I am not getting any errors, and the results are apparently being sent, but I still do not see the results listed in the Leaderboards! The leaderboard itself is listed in the Game Center, but there are no results.

According to Google's search and the question here, this can be resolved by trying to register points with multiple accounts. I tried three different accounts now both in Simulator (iOS5) and on my iPhone; not one of them detects errors when sending points.

The code that sends the invoice is here:

- (void)reportScore:(NSString *)identifier score:(int)rawScore { GKScore *score = [[[GKScore alloc] initWithCategory:identifier] autorelease]; score.value = rawScore; [scoresToReport addObject:score]; [self save]; // Save here even though we save again in didEnterBackground, just in case of crash... if (!gameCenterAvailable || !userAuthenticated) return; [self sendScore:score]; } - (void)sendScore:(GKScore *)score { [score reportScoreWithCompletionHandler:^(NSError *error) { dispatch_async(dispatch_get_main_queue(), ^(void) { if (error == NULL) { NSLog(@"Successfully sent score!"); [scoresToReport removeObject:score]; } else { NSLog(@"Score failed to send... will try again later. Reason: %@", error.localizedDescription); } }); }]; } 
+4
source share
2 answers

It suddenly started working (without any code change or even recompilation). I believe that in order for the testimony of leaders to really appear, it takes some time, for me about 18 hours.

Ratings submitted during this time will be recorded, they simply will not be displayed instantly.

+10
source

I have never had ratings to add to the sandbox, but here is the code I implemented and it works great with the version currently in the app store:

 GKScore * score = [[[GKScore alloc] initWithCategory:@"com.example.appname.scoreboardname"] autorelease]; score.value = [[NSUserDefaults standardUserDefaults] integerForKey:@"NEWSCORE"]; [score reportScoreWithCompletionHandler:^(NSError *error) { dispatch_async(dispatch_get_main_queue(), ^(void) { if (error == NULL) { NSLog(@"Score Sent"); } else { NSLog(@"Score Failed"); } }); }]; 

just make sure your GKScore.value is of type int64_t

0
source

Source: https://habr.com/ru/post/1394502/


All Articles