---
title: invalidationHandler
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsxpcconnection/invalidationhandler
---

# invalidationHandler

An invalidation handler that is called if the connection can not be formed or the connection has terminated and may not be re-established.

## Declaration

```swift
var invalidationHandler: (() -> Void)? { get set }
```

## Discussion

Discussion This handler is invoked on the same queue as reply messages and other handlers, and is always executed last (after the interruption handler, if required). You may not send messages over the connection from within an invalidation handler block.

## See Also

### Managing connection state

- [activate()](foundation/nsxpcconnection/activate().md)
- [resume()](foundation/nsxpcconnection/resume().md)
- [invalidate()](foundation/nsxpcconnection/invalidate().md)
- [suspend()](foundation/nsxpcconnection/suspend().md)
- [interruptionHandler](foundation/nsxpcconnection/interruptionhandler.md)
- [current()](foundation/nsxpcconnection/current().md)
- [scheduleSendBarrierBlock(_:)](foundation/nsxpcconnection/schedulesendbarrierblock(_:).md)
