Instance Method

transferUserInfo(_:)

Sends the specified data dictionary to the counterpart.

Declaration

func transferUserInfo(_ userInfo: [String : Any] = [:]) -> WCSessionUserInfoTransfer

Parameters

userInfo

A dictionary of property list values that you want to send. You define the contents of the dictionary that your counterpart supports. This parameter must not be nil.

Return Value

A transfer object that you can use to monitor and cancel the operation.

Discussion

Call this method when you want to send a dictionary of data to the counterpart and ensure that it is delivered. Dictionaries sent using this method are queued on the other device and delivered in the order in which they were sent. After a transfer begins, the transfer operation continues even if the app is suspended.

This method can only be called while the session is active—that is, the activationState property is set to WCSessionActivationState.activated. Calling this method for an inactive or deactivated session is a programmer error.

See Also

Transferring Data in the Background