<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileManager/uploadLocalVersionOfUbiquitousItem(at:withConflictResolutionPolicy:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileManager(im)uploadLocalVersionOfUbiquitousItemAtURL:withConflictResolutionPolicy:completionHandler:"
  },
  "title" : "uploadLocalVersionOfUbiquitousItem(at:withConflictResolutionPolicy:completionHandler:)"
}
-->

# uploadLocalVersionOfUbiquitousItem(at:withConflictResolutionPolicy:completionHandler:)

Asynchronously uploads the local version of the item using the provided conflict resolution policy.

```
func uploadLocalVersionOfUbiquitousItem(at url: URL, withConflictResolutionPolicy conflictResolutionPolicy: NSFileManagerUploadLocalVersionConflictPolicy, completionHandler: @escaping @Sendable (NSFileVersion?, (any Error)?) -> Void)
```

## Parameters

`url`

The URL of the item for which to check the version.

`conflictResolutionPolicy`

The policy the file manager applies if the local and server versions conflict.

`completionHandler`

A closure or block that the framework calls when the upload completes. It receives parameters of types [`NSFileVersion`](/documentation/Foundation/NSFileVersion) and [`NSError`](/documentation/Foundation/NSError). The error is `nil` if fetching the remote version succeeded; otherwise it indicates the error that caused the call to fail. In Swift, you can omit the completion handler, catching any error in a `do`-`catch` block and receiving the version as the return value.

## Discussion

Once your app pauses a sync for an item, call this method every time your document is in a stable state.
This action keeps the server version as up-to-date as possible.

If the server has a newer version than the one to which the app made changes, uploading fails with [`NSFileWriteUnknownError`](/documentation/Foundation/NSFileWriteUnknownError-c.enum.case), with an underlying error of <doc://com.apple.documentation/documentation/FileProvider/NSFileProviderError/localVersionConflictingWithServer>.
In this case, call [`fetchLatestRemoteVersionOfItem(at:completionHandler:)`](/documentation/Foundation/FileManager/fetchLatestRemoteVersionOfItem(at:completionHandler:)), rebase local changes on top of that version, and retry the upload.

If the device isn’t connected to the network, the call may fail with [`NSFileWriteUnknownError`](/documentation/Foundation/NSFileWriteUnknownError-c.enum.case), with the underlying error of <doc://com.apple.documentation/documentation/FileProvider/NSFileProviderError/serverUnreachable>.

---

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)