Initializes and returns a new record of the specified type.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 3.0+
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
nilor 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.
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.
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
CKModify object or using the saveRecord:completion: method of
CKDatabase to transfer the record’s contents to the server.