Instance Method

chooseBestHostPlayerWithCompletionHandler:

Determines the best player in the game to act as the server for a client-server match.

Declaration

- (void)chooseBestHostPlayerWithCompletionHandler:(void (^)(NSString *playerID))completionHandler;

Parameters

completionHandler

A block to be called after the best player has been determined.

The block receives the following parameter:

playerID

The player identifier for the player with the best estimated network performance, or nil if a player could not currently be determined.

Discussion

Calling this method causes Game Kit to attempt to estimate which player has the best overall network connection using a variety of metrics such as bandwidth, latency and network reliability. Typically, you call this method when your game implements a client-server model on top of the match’s peer-to-peer connection. See Game Center Programming Guide.

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

Deprecated Methods and Properties

playerIDs

An array of NSString objects containing the player identifiers for remote players in the match.

Deprecated
- sendData:toPlayers:withDataMode:error:

Transmits data to a list of connected players.

Deprecated