Type Method


Downloads the achievement descriptions from Game Center.


class func loadAchievementDescriptions(completionHandler: (([GKAchievementDescription]?, Error?) -> Void)? = nil)



A block to be called when the download is completed.

The block receives the following parameters:


An array of GKAchievementDescription objects containing the achievements in your game. If an error occurred, this value may be non-nil. In this case, the array holds whatever descriptions were downloaded by Game Kit before the error occurred.


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


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.

Loading and displaying achievements using a custon interface is a two-step process, with the first step being to call the loadAchievementDescriptions(completionHandler:) method. Calling this method loads all of the achievement descriptions for your game. The second step is to load an image only when it is required. See loadImage(completionHandler:) for more details.

Listing 1

Retrieving achievement metadata from Game Center

- (void) retrieveAchievmentMetadata
    [GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler:
        ^(NSArray *descriptions, NSError *error) {
            if (error != nil)
                NSLog(@"Faile to load achievement descriptions because of error: %@", error);
            if (descriptions != nil)
                // use the achievement descriptions.

See Also