Type Function Return value none Revision Release 2024.3703 Keywords iCloud, sync, storage, document, docRead See also iCloud.docWrite() iCloudDocEvent iCloud.*
Reads contents of specified file and invokes the onComplete
listener function with an iCloudDocEvent upon completion.
iCloud.docRead( params )
Table. Table containing
Valid keys for the params
table include:
filename
— Required; name of the file to be read.
onComplete
— Required listener function to be invoked with an iCloudDocEvent.
containerId
— Optional string value indicating a specific iCloud Container to be used for document storage. Do not pass this parameter if you have only one iCloud Container associated with your app.
local function docListener( event ) if not event.isError then print( event.contents ) -- Contents of document file (retrieved data) else print( event.error ) print( event.errorCode ) end end iCloud.docRead( { filename = "test.txt", onComplete = docListener } )