---
title: "session(_:didInvalidateWith:)"
framework: nearbyinteraction
role: symbol
role_heading: Instance Method
path: "nearbyinteraction/nisessiondelegate/session(_:didinvalidatewith:)"
---

# session(_:didInvalidateWith:)

Notifies you of an invalidated session.

## Declaration

```swift
optional func session(_ session: NISession, didInvalidateWith error: any Error)
```

## Parameters

- `session`: The invalidated session.
- `error`: The error that invalidated the session.

## Mentioned in

Initiating and maintaining a session

## Discussion

Discussion The delegate of an invalidated session receives no further callbacks, and the app can’t restart the session. To resume peer interaction, remove references to the invalidated session and begin a new session.
