reply(withLocalizableMessageKey:arguments:data:completionHandler:)
Replies to an exchange request on behalf of a recipient.
Declaration
func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data, completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data) async throwsParameters
- key:
The identifier for looking up the translated reply message in the default
Localized.stringsfile. If you use a formatted string with specifiers, provide the arguments. - arguments:
A list of arguments to substitute into the localized string if it’s formatted and contains specifiers.
- data:
The game-specific data associated with the reply.
- completionHandler:
The block that GameKit calls when it completes the request.
The block receives the following parameter:
- error
Describes an error if it occurs, or
nilif the operation completes.
Mentioned in
Discussion
To accept or decline an exchange request, invoke this method from the player(_:receivedExchangeRequest:for:) protocol method. Include game-specific details about the exchange in the data parameter. When all recipients reply or time out, GameKit invokes the player(_:receivedExchangeReplies:forCompletedExchange:for:) protocol method in the game instances of the sender and the current participant.