Contents

CKSyncEngineState

An object that manages the sync engine’s state.

Declaration

@interface CKSyncEngineState : NSObject

Overview

To reliably and consistently sync your app’s data, a sync engine keeps a record of several important pieces of data, such as server changes tokens (for databases and record zones), subscription identifiers, the most recent userRecordID, and so on. This class automatically manages that state on behalf of your app, but there are certain elements you can modify. For example, you control the list of pending changes to send to the iCloud servers and manipulate that list using the addPendingDatabaseChanges: and addPendingRecordZoneChanges: methods. If there aren’t any scheduled sync operations when you invoke these methods, the engine automatically schedules one.

An engine’s state changes periodically and, when it does, the sync engine dispatches an event of type CKSyncEngineStateUpdateEvent to your delegate. The event contains an instance of CKSyncEngineStateSerialization and, on receipt of such an event, it’s your responsibility to persist the serialized state to disk so that it’s available across app launches. On the next initialization of the sync engine, you provide the most recently persisted state as part of the engine’s configuration. For more information, see initWithDatabase:stateSerialization:delegate:.

Topics

Accessing pending changes

Modifying pending changes

Instance Properties

See Also

Accessing the engine’s attributes