---
title: "device(_:didCloseSessionWithError:)"
framework: imagecapturecore
role: symbol
role_heading: Instance Method
path: "imagecapturecore/icdevicedelegate/device(_:didclosesessionwitherror:)"
---

# device(_:didCloseSessionWithError:)

Tells the delegate when a session is closed on a device.

## Declaration

```swift
func device(_ device: ICDevice, didCloseSessionWithError error: (any Error)?)
```

## Discussion

Discussion This message completes the process initiated by the message “requestCloseSession” sent to the device object. This message is also sent if the device module in control of the device ceases to control the device. Execution of the delegate callback occurs on the main thread.

## See Also

### Responding to Device Events

- [device(_:didOpenSessionWithError:)](imagecapturecore/icdevicedelegate/device(_:didopensessionwitherror:).md)
- [didRemove(_:)](imagecapturecore/icdevicedelegate/didremove(_:).md)
- [deviceDidBecomeReady(_:)](imagecapturecore/icdevicedelegate/devicedidbecomeready(_:).md)
- [device(_:didReceiveStatusInformation:)](imagecapturecore/icdevicedelegate/device(_:didreceivestatusinformation:).md)
- [device(_:didEncounterError:)](imagecapturecore/icdevicedelegate/device(_:didencountererror:).md)
- [device(_:didEjectWithError:)](imagecapturecore/icdevicedelegate/device(_:didejectwitherror:).md)
