<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreNFC",
  "identifier" : "/documentation/CoreNFC/NFCReaderSessionProtocol/invalidate(errorMessage:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core NFC"
    ],
    "preciseIdentifier" : "c:objc(pl)NFCReaderSession(im)invalidateSessionWithErrorMessage:"
  },
  "title" : "invalidate(errorMessage:)"
}
-->

# invalidate(errorMessage:)

Closes the reader session and displays an error message to the user.

```
func invalidate(errorMessage: String)
```

## Parameters

`errorMessage`

The error message to display.

## Discussion

Use this method to end the reader session and display a message to the user when an error condition occurs after the app successfully reads a tag. This type of error can occur if, for example, the app reads data from an NFC tag, but determines that the data has expired and discards it. The app then calls [`invalidate(errorMessage:)`](/documentation/CoreNFC/NFCReaderSessionProtocol/invalidate(errorMessage:)) to end the reader session, and to let the user know why it discarded the data.

> Note:
> After invalidating a reader session, you cannot use it to scan and detect other tags.

---

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)