<!--
{
  "availability" : [
    "iOS: 8.0.0 - 15.0.0",
    "iPadOS: 8.0.0 - 15.0.0",
    "macCatalyst: 13.1.0 - 15.0.0",
    "macOS: 10.10.0 - 12.0.0",
    "tvOS: 9.0.0 - 15.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 3.0.0 - 8.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKFetchRecordZonesOperation/fetchRecordZonesCompletionBlock",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CKFetchRecordZonesOperation(py)fetchRecordZonesCompletionBlock"
  },
  "title" : "fetchRecordZonesCompletionBlock"
}
-->

# fetchRecordZonesCompletionBlock

The closure to execute after CloudKit retrieves all of the record zones.

```
var fetchRecordZonesCompletionBlock: (([CKRecordZone.ID : CKRecordZone]?, (any Error)?) -> Void)? { get set }
```

## Discussion

This property is a closure that returns no value and has the following parameters:

- A dictionary that maps the zone IDs you request to the results. The keys in the dictionary are [`CKRecordZone.ID`](/documentation/CloudKit/CKRecordZone/ID) objects, and the values are the corresponding [`CKRecordZone`](/documentation/CloudKit/CKRecordZone) objects that CloudKit returns.
- If CloudKit can’t retrieve any of the record zones, an error that provides information about the failure; otherwise, `nil`.

The operation executes the closure only once, and it’s your only chance to process the results. You must provide a closure capable of executing on a background thread, so any tasks that require access to the main thread must redirect accordingly.

The closure reports an error of type [`CKError.Code.partialFailure`](/documentation/CloudKit/CKError/Code/partialFailure) when it retrieves only some of the record zones successfully. The <doc://com.apple.documentation/documentation/Foundation/NSError/userInfo> dictionary of the error contains a [`CKPartialErrorsByItemIDKey`](/documentation/CloudKit/CKPartialErrorsByItemIDKey) key that has a dictionary as its value. The keys of the dictionary are the IDs of the record zones that the operation can’t retrieve, and the corresponding values are errors that contain information about the failures.

If you intend to use this closure to process results, set it before you execute the operation or submit the operation to a queue.

---

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)