sendMessage(withLocalizedFormatKey:arguments:data:to:badgePlayers:completionHandler:)
Sends a message to players in a game session.
Declaration
func sendMessage(withLocalizedFormatKey key: String, arguments: [String], data: Data?, to players: [GKCloudPlayer], badgePlayers: Bool, completionHandler: @escaping @Sendable ((any Error)?) -> Void)func sendMessage(withLocalizedFormatKey key: String, arguments: [String], data: Data?, to players: [GKCloudPlayer], badgePlayers: Bool) async throwsParameters
- key:
A localized string with format tokens.
- arguments:
An array containing entries for the format tokens contained by the
keyparameter. - data:
A
Dataobject containing a limited amount of developer determined game information. - players:
A
GKCloudPlayerarray containing the players to be messaged. - badgePlayers:
A
Booleanindicating whether players are badged when the message is sent. - completionHandler:
A block that is called after the message has been sent.
- error
If an error occurred, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is nil. See
GameKit Constantsfor a list of error codes specific to GameKit.