Instance Method

sendData:toPlayers:dataMode:error:

Transmits data to a list of connected players.

Declaration

- (BOOL)sendData:(NSData *)data toPlayers:(NSArray<GKPlayer *> *)players dataMode:(GKMatchSendDataMode)mode error:(NSError * _Nullable *)error;

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

YES if the data was successfully queued for transmission; NO 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

- chooseBestHostingPlayerWithCompletionHandler:

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

- sendDataToAllPlayers:withDataMode:error:

Transmits data to all players connected to the match.

GKMatchSendDataMode

The mechanism used to transmit data to other players.