Instance Method

initWithRecordType:recordID:

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

Declaration

- (instancetype)initWithRecordType:(CKRecordType)recordType recordID:(CKRecordID *)recordID;

Parameters

recordType

A string reflecting the type of record that you want to create. 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 consist of one or more alphanumeric characters and start with a letter. Type names may include underscore characters if they do not start with that character. Spaces are not allowed in record type names.

recordID

The ID to assign to the record itself. When creating the ID, you can specify the zone in which to place the record. The ID cannot currently be in use by any other record and must not be nil.

Return Value

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

Discussion

Use this method to initialize a new record object with the specified ID. The newly created record contains no data.

Upon creation, record objects exist only in memory on the local device. 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:

Initializes and returns a new record of the specified type.

- initWithRecordType:zoneID:

Initializes and returns a record in the specified zone.