Type Function Return value CloudKitRecord Revision Release 2024.3703 Keywords iCloud, sync, storage, CloudKit, recordCreate See also iCloud.recordCreateZone() iCloud.recordDelete() CloudKitRecord CloudKitRecord:save() CloudKitRecord:set() iCloud.*
Creates and returns a new CloudKitRecord object.
The created object is not stored in the CloudKit database. Use CloudKitRecord:save() to send it to the database.
iCloud.recordCreate( params )
Table. Table containing
Valid keys for the params
table include:
type
— Required string value representing the record type in the CloudKit database. Records of the same type have the same properties, similar to a table in a relational database.
recordName
— Optional string value representing a specific identifier for the record. If not set, a unique identifier will be generated.
zoneName
— Optional string value indicating the record’s zone name. You can use zones to group records, assuming the zone was created via iCloud.recordCreateZone(). If not specified, the default zone is used.
zoneOwner
— Optional string value indicating the record’s zone owner. If not specified, the default owner (current user) is used.
table
— Optional table containing field names and values to initialize the record with. The value associated with each field is typically passed as a table containing the required type
key, along with associated keys outlined in the CloudKitRecord:set() documentation. However, strings and numbers can be passed directly as a convenience method.
local recordData = { -- String and number values can be passed directly (convenience method) company = "Corona Labs", amount = 1, -- Other value types must be passed as a table where = { type="location", latitude=37.453139, longitude=122.113451 } } local record = iCloud.recordCreate( { type = "company", recordName = "Corona Labs 1", table = recordData } ) record:save()