iCloud.recordFetch()

Type Function
Return value none
Revision 2017.3060
Keywords iCloud, sync, storage, CloudKit, recordFetch
See also iCloud.recordFetchMultiple()
iCloud.recordQuery()
iCloudRecordEvent
iCloud.*

Overview

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.

Syntax

iCloud.recordFetch( params )
params (required)

Table. Table containing method-specific parameters — see the next section for details.

Parameter Reference

Valid keys for the params table include:

Example

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
    }
)