---
title: "getNonlocalVersionsOfItem(at:completionHandler:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nsfileversion/getnonlocalversionsofitem(at:completionhandler:)"
---

# getNonlocalVersionsOfItem(at:completionHandler:)

Asynchronously returns an array of NSFileVersions associated with the file located by the given URL, or nil if there is no such file or another error occurs.

## Declaration

```swift
class func getNonlocalVersionsOfItem(at url: URL, completionHandler: @escaping @Sendable ([NSFileVersion]?, (any Error)?) -> Void)
```

```swift
class func nonlocalVersionsOfItem(at url: URL) async throws -> [NSFileVersion]
```

## Discussion

Discussion Versions returned by this method do not initially have their contents stored locally on the device, so a download may be required before you are able to access them. File attributes are accessible via -[NSURL getPromisedItemResourceValue:forKey:error:]. You can request a download by performing a coordinated read with NSFileCoordinator on the URL property of the resulting NSFileVersions. When a version is successfully downloaded, its contents are cached locally, and the version will no longer be returned by this method. The version will be returned by +otherVersionsOfItemAtURL: instead, but will retain the same persistentIdentifier value.
