Instance Method

send(_:to:dataMode:)

Transmits data to a list of connected players.

Declaration

func send(_ data: Data, to players: [GKPlayer], dataMode mode: GKMatch.SendDataMode) throws

Parameters

data

The bytes to be sent.

players

An array of GKPlayer objects containing the identifier strings for the list of players who should receive the data.

mode

The mechanism used to send the data.

error

If the data could not be queued, on return, this parameter holds an NSError object describing the error.

Return Value

true if the data was successfully queued for transmission; false if the match was unable to queue the data.

Discussion

The match queues the data and transmits it when the network becomes available.

See Also

Sending Data to Other Players

func chooseBestHostingPlayer(completionHandler: (GKPlayer?) -> Void)

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

func sendData(toAllPlayers: Data, with: GKMatch.SendDataMode)

Transmits data to all players connected to the match.

enum GKMatch.SendDataMode

The mechanism used to transmit data to other players.