---
title: invalidate()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/nsxpcconnection/invalidate()
---

# invalidate()

Invalidates the connection.

## Declaration

```swift
func invalidate()
```

## Discussion

Discussion When you call this method, all outstanding reply blocks, error handling blocks, and invalidation blocks are called on the message handling queue. The connection must be invalidated before it is deallocated. After a connection is invalidated, no more messages may be sent or received.

## See Also

### Managing connection state

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