Contents

remove(withIdentifier:completionHandler:)

Removes the specified game session.

Declaration

class func remove(withIdentifier identifier: String, completionHandler: @escaping  @Sendable ((any Error)?) -> Void)
class func remove(withIdentifier identifier: String) async throws

Parameters

  • identifier:

    The unique string that identifies the game session to be removed.

  • completionHandler:

    A block that is called after a game session has been removed from a container.

    error

    If an error occurred, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is nil. See GameKit Constants for a list of error codes specific to GameKit.

Discussion

After the user has finished a game or decides to abandon a game, you must use this function to remove the game session from iCloud. Game sessions are not removed from iCloud automatically.

See Also

Creating and Loading Game Sessions