<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKDatabase/fetchAllRecordZones(completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CKDatabase(im)fetchAllRecordZonesWithCompletionHandler:"
  },
  "title" : "fetchAllRecordZones(completionHandler:)"
}
-->

# fetchAllRecordZones(completionHandler:)

Fetches all record zones from the current database.

```
func fetchAllRecordZones(completionHandler: @escaping @Sendable ([CKRecordZone]?, (any Error)?) -> Void)
```

## Parameters

`completionHandler`

The closure to execute with the fetch results.

## Discussion

The completion handler takes the following parameters:

- An array of fetched record zones, or `nil` if there’s an error. When present, the array contains at least one record zone, the default zone.
- An error if a problem occurs, or `nil` if CloudKit successfully fetches all record zones.

---

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)