Instance Method

reply(withLocalizableMessageKey:arguments:data:completionHandler:)

Replies to an exchange.

Declaration

func reply(withLocalizableMessageKey key: String, arguments: [String], data: Data, completionHandler: ((Error?) -> Void)? = nil)

Parameters

key

A string in the Localizable.strings file for the current localization.

arguments

An array of objects to be substituted using the format string.

data

The data associated with the exchange.

completionHandler

A block to be called after the reply has been sent.

The block receives the following parameters:

error

If an error occurred, this error object describes the error. If the operation was completed successfully, the value is nil.

Discussion

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. The completion handler is always called on the main thread.

See Also

Responding to an Exchange

var completionDate: Date?

The date when the exchange was completed.

var data: Data?

Data that is sent with the exchange.

var exchangeID: String

A persistent identifier that is used when referring to this exchange.

var message: String?

The localized message that is pushed to all of the recipients of the exchange.

var recipients: [GKTurnBasedParticipant]

The players to receive the exchange.

var sendDate: Date

The date that the exchange was sent out.

var sender: GKTurnBasedParticipant

The participant who sent the exchange.

var status: GKTurnBasedExchangeStatus

The current status of the exchange.

enum GKTurnBasedExchangeStatus

The status of an exchange or reply.

var timeoutDate: Date?

The amount of time the exchange is to stay active before timing out.