Sends the specified file and optional dictionary to the counterpart.
- iOS 9.0+
- Mac Catalyst 13.0+
- watchOS 2.0+
A file-based URL that identifies the file to send. The specified file must be readable by the current app. This parameter must not be
An optional dictionary containing additional data to send. The values of the dictionary must all be property list object types. You may specify
nilfor this parameter.
A file transfer object containing the file and dictionary being sent. You can use this object to cancel the file transfer at a later time.
Use this method to send a file that is local to the current device. Files are transferred to the counterpart asynchronously on a background thread. The system attempts to send files as quickly as possible but may throttle delivery speeds to accommodate performance and power concerns. Use the
outstanding method to get a list of files that are queued for delivery but have not yet been delivered to the counterpart.
If the file and its accompanying dictionary cannot be sent, the session object calls the session:fileTransfer:didFinishWithError: method of its delegate and reports an error. Errors may occur if the dictionary contains non property list object types or if the specified URL does not contain a valid file.
This method can only be called while the session is active—that is, the
activation property is set to
WCSession. Calling this method for an inactive or deactivated session is a programmer error.