Instance Method


Initializes and returns a new record of the specified type.


- (instancetype)initWithRecordType:(CKRecordType)recordType;



A string reflecting the type of record that you want to create. This string becomes the type of record thereafter and cannot be changed. You define the record types that your app supports and use them to distinguish between records with different types of data. This parameter must not be nil or contain an empty string.

Record type names must consist of one or more alphanumeric characters and must start with a letter. Type names may include underscore characters as long as they do not start with that character. Spaces are not allowed in the names.

Return Value

An initialized record object or nil if the record cannot be created.


Use this method to initialize a new record object in the default zone of the database. The newly created record contains no data in any of its fields and is assigned a unique ID.

// Create a new record of type "employee".
CKRecord* myRecord = [[CKRecord alloc] initWithRecordType:@"employee"];

New records exist only in memory until you explicitly save them to iCloud. In addition, new records are sparse by default and have no values assigned to the fields you defined. (In fact, until you set the value of a key explicitly, getting the value of a key in a new record returns nil.) Even though a record has an associated type, that type information is ignored until you save the record.

Save the record using a CKModifyRecordsOperation object or using the saveRecord:completion: method of CKDatabase to transfer the record’s contents to the server.

See Also

Initializing a Record

- initWithRecordType:zoneID:

Initializes and returns a record in the specified zone.

- initWithRecordType:recordID:

Initializes and returns a record using an ID that you provide.