Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Development: Why doesn't loadScoresWithCompletionHandler ever return?

I'm playing with the Game Kit API and I have a very simple block of code that never returns, not even with an error...

GKLeaderboard *pointsRequest = [[GKLeaderboard alloc] initWithPlayerIDs:[match playerIDs]];
if (pointsRequest != nil)
{
    //Set the points leaderboard category id
    [pointsRequest setCategory:kPOINTS_LEADERBOARD_ID];
    [pointsRequest loadScoresWithCompletionHandler: ^(NSArray *scores, NSError *error) 
    {
       if (error != nil)   //THIS LINE NEVER GETS HIT
       {
          NSLog(@"%@", [error localizedDescription]);           
       }

       if (scores != nil)  //NOR DOES THIS LINE
       {
        .
        .
        .

Since there's no error, I'm unsure of how to even troubleshoot this. Does anyone have any ideas what's wrong or how I can further investigate what's wrong?

Thanks so much for your wisdom!

UPDATE: I was finally able to get this block of code to return, tho I don't fully understand why. To get it to return, I posted a score to the leaderboard shortly before trying to retrieve it. What's strange is I had a score posted there before, so I don't know why posting a score had any effect on this problem.

like image 323
BeachRunnerFred Avatar asked Jul 25 '26 19:07

BeachRunnerFred


1 Answers

This actually might be a bug that just got corrected in the iOS 4.3 beta.

From the developer notes (source: gadgetsdna.com)

FIXED: GameKit now reports an error when achievement or a leaderboard score is not actually submitted.

I'm not a 100% sure this is related to your problem, but the only way to find out is either to enroll in the iOS developer program and test the latest beta or wait for the final iOS 4.3 SDK to come out.

like image 94
DavidD Avatar answered Jul 27 '26 13:07

DavidD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!