Instance Method

rematchWithCompletionHandler:

Create a new match with the list of players from an existing match.

Declaration

- (void)rematchWithCompletionHandler:(void (^)(GKMatch *match, NSError *error))completionHandler;

Parameters

completionHandler

A block to be called after the match is created.

The block receives the following parameter:

match

The new match. If an error occurred, this parameter’s value is nil.

error

If an error occurred, this parameter holds an error object that describes the problem. If the match was successfully recreated, this parameter’s value is nil.

Discussion

Calling this method uses auto-matching to recreate a previous match. A new match with the same set of players is created and returned. If your game attempts to recreate matches using this method, each instance of your game on each device should call this method.

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

Finishing the Match

- disconnect

Disconnects the local player from the match.