Instance Method

fetchSavedGames(completionHandler:)

Retrieves all available saved games.

Declaration

func fetchSavedGames(completionHandler handler: (([GKSavedGame]?, Error?) -> Void)? = nil)

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(_:with:completionHandler:) method.