iCloud.docConflictData()

Type Function
Return value none
Revision Release 2024.3703
Keywords iCloud, sync, storage, document, docConflictData
See also iCloud.docConflicts()
iCloudDocEvent
event.conflicts
iCloud.*

Overview

Retrieves contents of a document conflict gathered from iCloud.docConflicts() and invokes the onComplete listener function with an iCloudDocEvent upon completion.

Syntax

iCloud.docConflictData( 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 function printConflictData( event )

    print( "Conflict contents: " .. event.contents )
end

local function docListener( event )

    if event.conflicts then
        for i = 1,#event.conflicts do
            print( "Conflict origin: " .. event.conflicts[i].origin )
            print( "Conflict time: " .. event.conflicts[i].time )

            iCloud.docConflictData(
                {
                    conflict = event.conflicts[i].dataHandle,
                    onComplete = printConflictData
                }
            )
        end
    end
end

iCloud.docConflicts(
    {
        filename = "test.txt",
        onComplete = docListener
    }
)