Type Method

setDefaultLeaderboard:withCompletionHandler:

Sets the default leaderboard for the local player.

Declaration

+ (void)setDefaultLeaderboard:(NSString *)leaderboardIdentifier withCompletionHandler:(void (^)(NSError *error))completionHandler;

Parameters

leaderboardIdentifier

The named leaderboard that should be the new default leaderboard for the local player.

completionHandler

A block to be called after the scores are retrieved from the server.

The block receives the following parameter:

error

If an error occurred, this error object describes the error. If the operation was completed successfully, the value is nil.

Discussion

The default leaderboard is used whenever your game uses a GKScore object to report a score to Game Center without explicitly setting the score object’s category property. The default leaderboard is normally set in App Store Connect. However, your game can use this class method to override the default leaderboard that appears for the local player. This information is stored for each player on Game Center.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. The completion handler is always called on the main thread.

If an error occurs and was a network error, your game should periodically resend the request until it completes.

See Also

Deprecated Methods and Properties

category

The named leaderboard to retrieve information from.

Deprecated
- initWithPlayerIDs:

Initializes a leaderboard request to retrieve the scores of a specific group of players.

Deprecated
+ loadCategoriesWithCompletionHandler:

Loads the list of leaderboard categories along with their corresponding localized titles.

Deprecated