session(_:didReceiveMessage:with:from:)
Tells the listener a player has received a message from another player.
Declaration
optional func session(_ session: GKGameSession, didReceiveMessage message: String, with data: Data, from player: GKCloudPlayer)Parameters
- session:
The game session the sending player is associated with.
- message:
A
Stringcontaining the message sent to other players. - data:
Any data associated with the message. The value of this parameter can be
nil. - player:
The player who sent the message.
Discussion
This event fires after the sendMessage(withLocalizedFormatKey:arguments:data:to:badgePlayers:completionHandler:) method has been called. Only players contained in the players argument of the sendMessage(withLocalizedFormatKey:arguments:data:to:badgePlayers:completionHandler:) method are notified.