Instance Method

participantQuitInTurnWithOutcome:nextParticipants:turnTimeout:matchData:completionHandler:

Resigns the current player from the match without ending the match.

Declaration

- (void)participantQuitInTurnWithOutcome:(GKTurnBasedMatchOutcome)matchOutcome nextParticipants:(NSArray<GKTurnBasedParticipant *> *)nextParticipants turnTimeout:(NSTimeInterval)timeout matchData:(NSData *)matchData completionHandler:(void (^)(NSError *error))completionHandler;

Parameters

matchOutcome

The end outcome of the current player in the match. Do not pass nil as an argument.

nextParticipants

An array of GKTurnBasedParticipant 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’s 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.

See Also

Leaving a Match

- participantQuitOutOfTurnWithOutcome:withCompletionHandler:

Resigns the player from the match when that player is not the current player. This action does not end the match