Type Function Return value none Revision Release 2025.3721 Keywords iCloud, sync, storage, CloudKit, recordFetch See also iCloud.recordFetchMultiple() iCloud.recordQuery() iCloudRecordEvent iCloud.*
Retrieves a single record and passes the results to the onComplete listener function as an iCloudRecordEvent.
To fetch multiple records in the same call, use iCloud.recordFetchMultiple() instead.
iCloud.recordFetch( params )
Table. Table containing
Valid keys for the params table include:
recordName — Required string value representing the identifier for the record.
onComplete — Required listener function to be invoked with an iCloudRecordEvent.
zoneName — Optional string value indicating the record’s zone name.
zoneOwner — Optional string value indicating the record’s zone owner.
database — Optional string value indicating the record’s database.
containerId — Optional string value indicating a specific iCloud Container in which the record is contained. Do not pass this parameter if you have only one iCloud Container associated with your app.
local json = require( "json" )
-- Listener function to handle the fetch request
local function fetchResults( event )
if event.record then
print( "Record is: ", json.prettify( event.record:table() ) )
else
print( "Record not fetched!" )
end
end
iCloud.recordFetch(
{
recordName = "Corona Labs 1",
onComplete = fetchResults
}
)