Instance Method

resolveConflictingSavedGames(_:with:completionHandler:)

Resolves any conflicting saved games.

Declaration

func resolveConflictingSavedGames(_ conflictingSavedGames: [GKSavedGame], with data: Data, completionHandler handler: (([GKSavedGame]?, Error?) -> Void)? = nil)

Parameters

conflictingSavedGames

An array of GKSavedGame objects containing the conflicting saved games to be deleted.

data

An object that contains the saved game data.

handler

A block to be called when the request completes.

The block receives the following parameters:

savedGames

An array of GKSavedGame objects containing a saved game list with all conflicts contained in the conflictingSavedGames parameter resolved. If there are any conflicting saved game files that were not in the conflictingSavedGames parameter, these objects will automatically be appended to the end of the savedGames array. For example, if there are five saved game files with the same name, but only three are in the conflictingSavedGames array, this array will contain the resolved saved game file and the two unresolved files.

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 takes an array of GKSavedGame objects that contain conflicting saved game files and creates a new array that contains the resolved conflicts. All saved game conflicts are resolved and added to the savedGames array in the completion handler. Call this method separately for each set of saved game conflicts. For example, if you have multiple saved game files with the name of “savedgame1” and “savedgame2”, you need to call this method twice—once with an array containing the GKSavedGame objects with the “savedgame1” name and once for the “savedgame2” objects. All saved game conflicts are resolved asynchronously.