<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WatchConnectivity",
  "identifier" : "/documentation/WatchConnectivity/WCSession/transferFile(_:metadata:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Watch Connectivity"
    ],
    "preciseIdentifier" : "c:objc(cs)WCSession(im)transferFile:metadata:"
  },
  "title" : "transferFile(_:metadata:)"
}
-->

# transferFile(_:metadata:)

Sends the specified file and optional dictionary to the counterpart.

```
func transferFile(_ file: URL, metadata: [String : Any]?) -> WCSessionFileTransfer
```

## Parameters

`file`

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 `nil`.

`metadata`

An optional dictionary containing additional data to send. The values of the dictionary must all be property list object types. You may specify `nil` for this parameter.

## Return Value

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.

## Discussion

Use this method to send a file that’s 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 [`outstandingFileTransfers`](/documentation/WatchConnectivity/WCSession/outstandingFileTransfers) 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 can’t 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 doesn’t contain a valid file.

This method can only be called while the session is active (the [`activationState`](/documentation/WatchConnectivity/WCSession/activationState) property is set to [`WCSessionActivationState.activated`](/documentation/WatchConnectivity/WCSessionActivationState/activated)). Calling this method for an inactive or deactivated session is a programmer error.

> Warning:
> Always test Watch Connectivity file transfers on paired devices. The Simulator app doesn’t support the ``doc://com.apple.watchconnectivity/documentation/WatchConnectivity/WCSession/transferFile(_:metadata:)`` method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)