<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "watchOS: 7.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NearbyInteraction",
  "identifier" : "/documentation/NearbyInteraction/NISessionDelegate/session(_:didInvalidateWith:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Nearby Interaction"
    ],
    "preciseIdentifier" : "c:objc(pl)NISessionDelegate(im)session:didInvalidateWithError:"
  },
  "title" : "session(_:didInvalidateWith:)"
}
-->

# session(_:didInvalidateWith:)

Notifies you of an invalidated session.

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

## Parameters

`session`

The invalidated session.

`error`

The error that invalidated the session.

## 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)