---
title: "session(_:didFinish:error:)"
framework: watchconnectivity
role: symbol
role_heading: Instance Method
path: "watchconnectivity/wcsessiondelegate/session(_:didfinish:error:)-8627b"
---

# session(_:didFinish:error:)

Tells the delegate that a data transfer operation has finished successfully or ended because of an error.

## Declaration

```swift
optional func session(_ session: WCSession, didFinish userInfoTransfer: WCSessionUserInfoTransfer, error: (any Error)?)
```

## Parameters

- `session`: The session object of the current process.
- `userInfoTransfer`: An object containing information about the data that was transferred.
- `error`: An error object if a problem occurred.

## Discussion

Discussion The session object calls this method when a data transfer initiated by the current app finished, either successfully or unsuccessfully. Use this method to note that the transfer completed or to respond to errors, perhaps by trying to send the data again at a later time. This method is called on a background thread of your app.

## See Also

### Managing Data Dictionary Transfers

- [session(_:didReceiveUserInfo:)](watchconnectivity/wcsessiondelegate/session(_:didreceiveuserinfo:).md)
