In terms of Apple's game center apis, how would I request and get back the local users time and rankings for a particular Leaderboard and Timescope?
Copied from the Game Center Programming Guide:
GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init];
if (leaderboardRequest != nil)
{
leaderboardRequest.playerScope = GKLeaderboardPlayerScopeGlobal; // or GKLeaderboardPlayerScopeFriendsOnly
leaderboardRequest.timeScope = GKLeaderboardTimeScopeToday; // or GKLeaderboardTimeScopeWeek, GKLeaderboardTimeScopeAllTime
leaderboardRequest.identifier = @"Combined.LandMaps" // Name of the leaderboard
leaderboardRequest.range = NSMakeRange(1,10); // How many results to get
[leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores, NSError *error) {
if (error != nil)
{
// Handle the error.
}
if (scores != nil)
{
// Process the score information.
}
}];
}
To get information for a specific users:
GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] initWithPlayerIDs: match.playerIDs];
In both cases the score of the user are stored in localPlayerScore and all scores in scores.
The ranking however could be problematic. You can only get up to 100 scores maximum, so if the leaderboard is very big it can take a lot of calls. localPlayerScore does contain a rank value, but that is only relative to the current scores list. Basically you have to iterate over the whole leaderboard to find the position of the user.