<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SecurityInterface",
  "identifier" : "/documentation/SecurityInterface/SFAuthorizationPluginView/lastError()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Security Interface"
    ],
    "preciseIdentifier" : "c:objc(cs)SFAuthorizationPluginView(im)lastError"
  },
  "title" : "lastError()"
}
-->

# lastError()

Returns the last error that occurred during evaluation.

```
func lastError() -> (any Error)!
```

## Discussion

Your authorization plug-in should override this method and return the last error that occurred during evaluation or `nil` if no error occurred.

A downstream plug-in can set a context value using the `kAuthorizationContextFlagSticky` flag to make it available to the `SFAuthorizationPluginView` class in case of an error.

---

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)