resolveConflictingSavedGames(_:with:completionHandler:)
Replaces duplicate saved games that use the same filename with one file containing the specified game data.
Declaration
func resolveConflictingSavedGames(_ conflictingSavedGames: [GKSavedGame], with data: Data, completionHandler handler: (@Sendable ([GKSavedGame]?, (any Error)?) -> Void)? = nil)func resolveConflictingSavedGames(_ conflictingSavedGames: [GKSavedGame], with data: Data) async throws -> [GKSavedGame]Parameters
- conflictingSavedGames:
The saved games that contain the conflicts.
- data:
The correct game data to save.
- handler:
The block that this method calls when it completes the request.
The block receives the following parameters:
- savedGames
The resolved saved games that you include in
conflictingSavedGames, and any other saved games GameKit finds with conflicts that you don’t include inconflictingSavedGames.
For example, if there are five saved game files with the same filename, but only three are in
conflictingSavedGames, this parameter contains the three saved games you provide and the two saved games GameKit finds.- error
Describes an error if it occurs, or
nilif the operation completes.
Mentioned in
Discussion
Implement the player(_:hasConflictingSavedGames:) protocol method to choose the correct game data when there’s a conflict. Then call this method separately for each set of saved games that contain file conflicts. For example, if multiple saved games use the savedgame1 and savedgame2 filenames, call this method once for the saved games that use the savedgame1 filename, and once for the saved games that use the savedgame2 filename.