Instance Method

fetchSavedGamesWithCompletionHandler:

Retrieves all available saved games.

Declaration

- (void)fetchSavedGamesWithCompletionHandler:(void (^)(NSArray<GKSavedGame *> *savedGames, NSError *error))handler;

Parameters

handler

A block to be called when the request completes.

The block receives the following parameters:

savedGames

An array of GKSavedGame objects containing the retrieved games.

error

If an error occurred, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is nil.

Discussion

This method retrieves saved game files asynchronously. When there is more than one saved game with the same name, a conflict occurs. The app must determine which saved game file is correct and call the resolveConflictingSavedGames:withData:completionHandler: method.

See Also

Working with Saved Games

- deleteSavedGamesWithName:completionHandler:

Deletes a specific saved game file.

- saveGameData:withName:completionHandler:

Saves game data under the specified name.