iOS Developer Library — Pre-Release

Developer

GameKit Framework Reference GKLeaderboardSet Class Reference

Options
Deployment Target:

On This Page
Language:

GKLeaderboardSet

Add leaderboard sets to your app and organize your leaderboards into logical and coherent groups. Once you incorporate leaderboard sets into your app, you must put all of your leaderboards into a set. Individual leaderboards can be put into multiple leaderboard sets and given different display names in each set. More...

Inheritance


Import Statement


Swift

import GameKit

Objective-C

@import GameKit;

Availability


Available in iOS 7.0 and later.
  • Load the image associated with the leaderboard set.

    Declaration

    Swift

    func loadImageWithCompletionHandler(_ completionHandler: ((UIImage!, NSError!) -> Void)!)

    Objective-C

    - (void)loadImageWithCompletionHandler:(void (^)(UIImage *image, 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:

    image

    The image associated with the leaderboard set. If an error occurred, this value will 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

    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.

    Import Statement

    Swift

    import GameKit

    Availability

    Available in iOS 7.0 and later.

  • Load all of the leaderboard sets for the current game.

    Declaration

    Swift

    class func loadLeaderboardSetsWithCompletionHandler(_ completionHandler: (([AnyObject]!, NSError!) -> Void)!)

    Objective-C

    + (void)loadLeaderboardSetsWithCompletionHandler:(void (^)(NSArray *leaderboardSets, 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:

    leaderboardSets

    An array of GKLeaderboardSet objects that provides the leaderboard sets for 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.

    error

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

    Discussion

    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.

    Import Statement

    Swift

    import GameKit

    Availability

    Available in iOS 7.0 and later.

  • Load all of the leaderboards for the current leaderboard set.

    Declaration

    Swift

    func loadLeaderboardsWithCompletionHandler(_ completionHandler: (([AnyObject]!, NSError!) -> Void)!)

    Objective-C

    - (void)loadLeaderboardsWithCompletionHandler:(void (^)(NSArray *leaderboards, 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:

    leaderboards

    An array of GKLeaderboard objects that provides the leaderboards for 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.

    error

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

    Discussion

    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.

    Import Statement

    Swift

    import GameKit

    Availability

    Available in iOS 7.0 and later.

  • title title Property

    Localized title for the leaderboard set. (read-only)

    Declaration

    Swift

    var title: String! { get }

    Objective-C

    @property(readonly, copy, nonatomic) NSString *title

    Import Statement

    Swift

    import GameKit

    Availability

    Available in iOS 7.0 and later.

  • The identifier for the leaderboard set.

    Declaration

    Swift

    var identifier: String!

    Objective-C

    @property(copy, nonatomic) NSString *identifier

    Import Statement

    Swift

    import GameKit

    Availability

    Available in iOS 7.0 and later.

  • Identifies the group that the leaderboard set belongs to. (read-only)

    Declaration

    Swift

    var groupIdentifier: String! { get }

    Objective-C

    @property(nonatomic, readonly, retain) NSString *groupIdentifier

    Discussion

    This is set when the leaderboard set is part of a game group. It gets set when loadLeaderboardSetsWithCompletionHandler: is called on leaderboards that support game groups.

    Import Statement

    Swift

    import GameKit

    Availability

    Available in iOS 7.0 and later.