Instance Method

endMatchInTurnWithMatchData:completionHandler:

Ends the match.

Declaration

- (void)endMatchInTurnWithMatchData:(NSData *)matchData completionHandler:(void (^)(NSError *error))completionHandler;

Parameters

matchData

A serialized blob of data reflecting the end state for the match. Do not pass nil as an argument.

completionHandler

A block to be called after the match is successfully ended.

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

Calling this method ends the match for all players. This method may only be called by the current participant. Before your game calls this method, the matchOutcome property on each participant object stored in the participants property must have been set to a value other than GKTurnBasedMatchOutcomeNone.

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

Ending a Match

- endMatchInTurnWithMatchData:scores:achievements:completionHandler:

Ends the match while submitting all of the scores and achievements.