<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FileProvider",
  "identifier" : "/documentation/FileProvider/NSFileProviderManager/getIdentifierForUserVisibleFile(at:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "File Provider"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileProviderManager(cm)getIdentifierForUserVisibleFileAtURL:completionHandler:"
  },
  "title" : "getIdentifierForUserVisibleFile(at:completionHandler:)"
}
-->

# getIdentifierForUserVisibleFile(at:completionHandler:)

Returns the identifier and domain for a user-visible URL.

```
class func getIdentifierForUserVisibleFile(at url: URL, completionHandler: @escaping @Sendable (NSFileProviderItemIdentifier?, NSFileProviderDomainIdentifier?, (any Error)?) -> Void)
```

## Parameters

`url`

The URL of the item.

`completionHandler`

A block that the system calls after it gets the items identifier. It has the following parameters:

- `itemIdentifier`: The item’s identifier.
- `domainIdentifier`: The identifier for the item’s domain.
- `error`: If an error occurs, this object contains information about the error; otherwise, it’s `nil`.

## Discussion

> Important:
> You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
> 
> ```swift
> class func identifierForUserVisibleFile(at url: URL) async throws -> (NSFileProviderItemIdentifier, NSFileProviderDomainIdentifier)
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/calling-objective-c-apis-asynchronously>.

If the URL doesn’t refer to an item managed by your File Provider extension, the system returns a <doc://com.apple.documentation/documentation/Foundation/NSFileNoSuchFileError-swift.var> 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)