Resigns the current player from the match without ending the match.
SDKs
- iOS 6.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
Framework
- Game
Kit
Declaration
func participantQuitInTurn(with matchOutcome: GKTurn Based Match.Outcome, nextParticipants: [GKTurn Based Participant], turnTimeout timeout: Time Interval, match matchData: Data, completionHandler: ((Error?) -> Void)? = nil)
Parameters
matchOutcome
The end outcome of the current player in the match. Do not pass
nil
as an argument.nextParticipants
An array of
GKTurn
objects that contains participant objects reflecting the order in which the players should act next. Each object in the array must be one of the objects stored in the match’sBased Participant participants
property.timeout
The length of time the next player has to complete their turn.
matchData
A serialized blob of data reflecting the game-specific state for the match.
completionHandler
A block to be called after the data is uploaded to the server.
The block receives the following parameters:
- error
If an error occurred, this error object describes the error. If the operation was completed successfully, the value is
nil
.
Discussion
Your game calls this method on an instance of your game that is processing the current player’s turn, but that player has left the match. For example, the player may have willingly resigned from the match or that player may have been eliminated by the other players (based on your game’s internal logic).
If the next player to act does not take their turn in the specified interval, the next player in the array receives a notification to act. This process continues until a player takes a turn or the last player in the list is notified.
When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. The completion handler is always called on the main thread.