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

# invalidate()

Stops a running session.

```
func invalidate()
```

## Discussion

When an app calls this function, NI invokes [`session(_:didRemove:reason:)`](/documentation/NearbyInteraction/NISessionDelegate/session(_:didRemove:reason:)) on the peer’s side and passes in the `reason` [`NINearbyObject.RemovalReason.peerEnded`](/documentation/NearbyInteraction/NINearbyObject/RemovalReason/peerEnded). The app can’t restart invalid sessions.

---

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)