<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKSyncEngine-4b4w9/fetchChangesWithCompletionHandler:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CKSyncEngine(im)fetchChangesWithCompletionHandler:"
  },
  "title" : "fetchChangesWithCompletionHandler:"
}
-->

# fetchChangesWithCompletionHandler:

Fetches pending remote changes from the server.

```
- (void) fetchChangesWithCompletionHandler:(void (^)(NSError *error)) completionHandler;
```

## Parameters

`completionHandler`

The block to execute when the fetch completes.

## Discussion

If the fetch fails, the completion handler’s `error` parameter is an object that describes that failure; otherwise, it’s `nil`.

Use this method to request the sync engine immediately fetches all pending remote changes before your app continues.
This isn’t necessary in normal use, as the engine automatically syncs your app’s records.
It is useful, however, in scenarios where you require more control over sync, such as pull-to-refresh or unit tests.

> Note: The sync engine invokes the completion handler only after your sync delegate finishes processing all related fetch events.

---

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)