<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FileProvider",
  "identifier" : "/documentation/FileProvider/NSFileProviderExtension/persistentIdentifierForItem(at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "File Provider"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileProviderExtension(im)persistentIdentifierForItemAtURL:"
  },
  "title" : "persistentIdentifierForItem(at:)"
}
-->

# persistentIdentifierForItem(at:)

Returns a unique identifier for the given URL.

```
func persistentIdentifierForItem(at url: URL) -> NSFileProviderItemIdentifier?
```

## Parameters

`url`

The URL of a shared document.

## Return Value

A unique identifier for the item specified by the URL, or `nil` if the document is not in the File Provider’s shared container.

## Discussion

Override this method to define a static mapping between URLs and their persistent identifiers. A document’s identifier should remain constant over time; it should not change when the document is edited, moved, or renamed.

For example, if you already have a unique key for the document in your cloud database, you can use that key as the document’s identifier.

Always return `nil` if the URL is not inside in the directory referred to by the [`NSFileProviderManager`](/documentation/FileProvider/NSFileProviderManager) object’s [`documentStorageURL`](/documentation/FileProvider/NSFileProviderManager/documentStorageURL) property.

---

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)