Class

CKRecordZone.ID

An object that uniquely identifies a record zone in a database.

Declaration

class ID : NSObject

Overview

Zones are a way to group related records together. You create zone ID objects when you want to fetch an existing zone object or create a new zone with a specific name.

A record zone ID distinguishes one zone from another by a name string and the ID of the user that created the zone. Both strings must be ASCII strings that do not exceed 255 characters. For automatically created record zones, the ID name string is based on a UUID and is therefore guaranteed to be unique. When creating your own record zone ID objects, you are free to use names that have more meaning to your app or to the user, providing each zone name is unique within the specified database. The owner name must be either the current user name (obtained from the fetchUserRecordID(completionHandler:) method) or the name of another user.

When creating new record zones, make the name string in the record zone ID unique in the target database. Public databases do not support custom zones, and zones in a private database can only be created by the user that owns the database.

This class is not intended to be subclassed.

Interacting with Record Zone IDs

After you create a CKRecordZoneID object, interactions with that object typically include:

  • Creating a CKRecord.ID object so that you can fetch or create records in that zone.

  • Retrieving an existing CKRecordZone object from the database.

You do not need to create a CKRecordZoneID object in order to create a CKRecordZone object. The CKRecordZone class has initialization methods that create a record zone ID using the name string you provide.

Creating Record Zone IDs to Use with Records

To create a new record in a custom zone, first create a CKRecordZoneID object that specifies the zone name. Use the record zone ID to create a CKRecord.ID and then use the record ID to create the record itself.

Fetching a Record Zone Object from the Database

To fetch a CKRecordZone object from a database, use a CKFetchRecordZonesOperation object or the fetchRecordZoneWithID:completion: method of the CKDatabase class. Both techniques take a CKRecordZoneID object that you provide and retrieve the corresponding record zone object asynchronously. If you use the operation object, you can retrieve multiple record zones at the same time.

Topics

Initializing a Record Zone ID

init(zoneName: String, ownerName: String)

Initializes and returns a record zone ID with the specified name and owner.

Getting the Record Zone ID Attributes

var zoneName: String

The unique name of the record zone.

var ownerName: String

The ID of the user who owns the record zone.

Relationships

Inherits From

See Also

Getting the Zone Attributes

var zoneID: CKRecordZone.ID

The unique ID of the zone.

var capabilities: CKRecordZone.Capabilities

The capabilities supported by the zone.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software