native.setSync()

Type Function
Library native.*
Return value Boolean and String
Revision 2017.3060
Keywords sync, iCloud, backup, documents
See also native.getSync()

Overview

Sets the iCloud automatic backup flag for files in the system.DocumentsDirectory and system.ApplicationSupportDirectory on macOS and iOS systems.

The iCloud backup is true by default and must be set false with this API to disable automatic backup of files to iCloud.

This function returns up to two values:

Gotchas

This function is for macOS and iOS platforms only.

Syntax

native.setSync( filename, params )
filename (required)

String. Name of file (including path).

params (required)

Table. Set to { iCloudBackup = flag } where flag is true to enable iCloud backup (default) or false to disable it.

Examples

-- Disable file backup
-- Assumes that a file named 'SavedData.txt' is in 'system.DocumentsDirectory'

local results, errStr = native.setSync( "SavedData.txt", { iCloudBackup = false } ) 
-- Disable file backup in a subdirectory within the Documents directory
-- Assumes that a file named 'SavedData.txt' is in a 'data' subdirectory of 'system.DocumentsDirectory'

local results, errStr = native.setSync( "data/SavedData.txt", { iCloudBackup = false } )