I'm using a Game Center leaderboard, which works fine and shows scores as it should do. The only problem is when I simulate a network failure (well, put the phone into airplane mode) it still returns a null error when posting a score. The posting code is -
[scoreReporter reportScoreWithCompletionHandler: ^(NSError *error)
{
[self callDelegateOnMainT开发者_开发技巧hread: @selector(scoreReported:) withArg: NULL error: error];
}];
which you would expect to return "unsuccessful" in this case. I've no idea what's going on! Any help appreciated, thanks.
Well, I've sort of worked around it - I've used Apple's Reachability code just to check if the phone can connect, then I do the Game Center stuff. It's weird, but the Game Center doesn't show any error if there's no network when it submits a score, but it does if there is a network & it can't connect to its servers. Unless I'm doing something totally wrong, but it's more-or-less a cut & paste of their own example code.
精彩评论