Deprecated GKLeaderboard Methods

A method identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in iOS 6.0

loadCategoriesWithCompletionHandler:

Loads the list of leaderboard categories along with their corresponding localized titles. (Deprecated in iOS 6.0. Use the loadLeaderboardsWithCompletionHandler: method instead.)

+ (void)loadCategoriesWithCompletionHandler:(void (^)(NSArray *categories, NSArray *titles, NSError *error))completionHandler
Parameters
completionHandler

A block that is called when the categories have been retrieved from the server.

The block receives the following parameters:

categories

An array of NSString objects that provides the categories to your game. If an error occurred, this value may be non-nil. In this case, the array holds whatever data Game Kit was able to download before the error occurred.

titles

An array of NSString objects that provides localized titles for each category. If an error occurred, this value may be non-nil. In this case, the array holds whatever data Game Kit was able to download before the error occurred.

error

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

Discussion

You use this class method to retrieve the category identifiers and titles you configured for your leaderboards on iTunes Connect. To create a leaderboard query that targets a particular category, set the category property to one of the strings returned by this method.

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.

Availability
  • Available in iOS 4.1 and later.
  • Deprecated in iOS 6.0.
Declared In
GKLeaderboard.h

Deprecated in iOS 7.0

category

The named leaderboard to retrieve information from. (Deprecated in iOS 7.0. Use identifier property instead.)

@property(copy, nonatomic) NSString *category
Discussion

If non-nil, Game Center only returns scores from the matching leaderboard. If nil, all scores previously reported by the game are searched. Default is nil.

Availability
  • Available in iOS 4.1 and later.
  • Deprecated in iOS 7.0.
Related Sample Code
Declared In
GKLeaderboard.h

setDefaultLeaderboard:withCompletionHandler:

Sets the default leaderboard for the local player. (Deprecated in iOS 7.0.)

+ (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 iTunes 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.

Availability
  • Available in iOS 5.0 and later.
  • Deprecated in iOS 7.0.
Declared In
GKLeaderboard.h