SFMobileSyncSyncManager Class Reference

Inherits from NSObject
Declared in SFMobileSyncSyncManager.h

Overview

This class provides methods for doing synching records to/from the server from/to the smartstore.

Other Methods

  store

@property (nonatomic, strong, readonly) SFSmartStore *store

+ sharedInstance:

Singleton method for accessing the sync manager instance for the given user. This instance uses the default store.

+ (instancetype)sharedInstance:(SFUserAccount *)user

Parameters

user

User to which this manager instance’s data is scoped.

Declared In

SFMobileSyncSyncManager.h

+ sharedInstanceForUser:storeName:

Singleton method for accessing a sync manager based on a user and store name. This instance uses the store with the given name for the given user.

+ (instancetype)sharedInstanceForUser:(SFUserAccount *)user storeName:(nullable NSString *)storeName

Parameters

user

User associated with the store.

storeName

Name of the requested store.

Declared In

SFMobileSyncSyncManager.h

+ sharedInstanceForStore:userAccount:

Singleton method for accessing a sync manager based on user and store name. This instance uses the store with the given name for the given user.

+ (instancetype)sharedInstanceForStore:(nullable NSString *)storeName userAccount:(SFUserAccount *)userAccount

Parameters

storeName

Name of the requested store.

userAccount

User associated with the store.

Declared In

SFMobileSyncSyncManager.h

+ sharedInstanceForStore:

Singleton method for accessing sync manager instance by SmartStore store.

+ (nullable instancetype)sharedInstanceForStore:(SFSmartStore *)store

Parameters

store

SmartStore instance whose sync manager is being requested.

Declared In

SFMobileSyncSyncManager.h

+ removeSharedInstance:

Remove the shared instance associated with the given user.

+ (void)removeSharedInstance:(SFUserAccount *)user

Parameters

user

User associated with the store.

Declared In

SFMobileSyncSyncManager.h

+ removeSharedInstanceForUser:storeName:

Remove the shared instance associated with the given user and store name.

+ (void)removeSharedInstanceForUser:(SFUserAccount *)user storeName:(nullable NSString *)storeName

Parameters

user

User associated with the store.

storeName

Name of the requested store.

Declared In

SFMobileSyncSyncManager.h

+ removeSharedInstanceForStore:userAccount:

Remove the shared instance associated with the given store name and user.

+ (void)removeSharedInstanceForStore:(nullable NSString *)storeName userAccount:(SFUserAccount *)userAccount

Parameters

storeName

Name of the requested store.

userAccount

User associated with the store.

Declared In

SFMobileSyncSyncManager.h

+ removeSharedInstanceForStore:

Remove the shared instance associated with the specified store.

+ (void)removeSharedInstanceForStore:(SFSmartStore *)store

Parameters

store

SmartStore instance whose sync manager is to be removed.

Declared In

SFMobileSyncSyncManager.h

+ removeSharedInstances

Remove all shared instances.

+ (void)removeSharedInstances

Declared In

SFMobileSyncSyncManager.h

– stop

Stop the sync manager. It can take a while for active syncs to actually stop. Call isStopped() to see if the sync manager is fully paused.

- (void)stop

Declared In

SFMobileSyncSyncManager.h

– isStopping

YES if a stop was requested but some syncs are still active.

- (BOOL)isStopping

Return Value

YES if a stop was requested but some syncs are still active.

Declared In

SFMobileSyncSyncManager.h

– isStopped

YES if a stop was requested and no syncs are still active.

- (BOOL)isStopped

Return Value

YES if a stop was requested and no syncs are still active.

Declared In

SFMobileSyncSyncManager.h

– restart:updateBlock:error:

Restart this sync manager.

- (BOOL)restart:(BOOL)restartStoppedSyncs updateBlock:(SFSyncSyncManagerUpdateBlock)updateBlock error:(NSError **)error

Parameters

restartStoppedSyncs

Pass YES to restart all stopped syncs.

updateBlock

Block to be called with updates.

error

Reports any error (optional).

Return Value

YES if restarted successfully.

Declared In

SFMobileSyncSyncManager.h

– checkAcceptingSyncs:

Check whether a sync manager is running.

- (BOOL)checkAcceptingSyncs:(NSError **)error

Parameters

error

Reports any error (optional).

Return Value

YES if the sync manager is running, or NO if it’s stopping or stopped.

Declared In

SFMobileSyncSyncManager.h

– getSyncStatus:

Return status of the sync with the given sync ID.

- (nullable SFSyncState *)getSyncStatus:(NSNumber *)syncId

Parameters

syncId

Sync ID.

Declared In

SFMobileSyncSyncManager.h

– getSyncStatusByName:

Return status of the sync with the given name.

- (nullable SFSyncState *)getSyncStatusByName:(NSString *)syncName

Parameters

syncName

Sync name.

Declared In

SFMobileSyncSyncManager.h

– hasSyncWithName:

Return YES if a sync with the given name exists.

- (BOOL)hasSyncWithName:(NSString *)syncName

Parameters

syncName

Sync name.

Return Value

YES a sync with the given name exists.

Declared In

SFMobileSyncSyncManager.h

– deleteSyncById:

Delete the sync with the given ID.

- (void)deleteSyncById:(NSNumber *)syncId

Parameters

syncId

Sync ID.

Declared In

SFMobileSyncSyncManager.h

– deleteSyncByName:

Delete the sync with the given name.

- (void)deleteSyncByName:(NSString *)syncName

Parameters

syncName

Sync name.

Declared In

SFMobileSyncSyncManager.h

– createSyncDown:options:soupName:syncName:

Create a sync down without running it.

- (SFSyncState *)createSyncDown:(SFSyncDownTarget *)target options:(SFSyncOptions *)options soupName:(NSString *)soupName syncName:(nullable NSString *)syncName

Parameters

target

Sync down target that will manage the sync down process.

options

Options associated with this sync down.

soupName

Soup name where the local entries are stored.

syncName

Name for this sync (optional).

Return Value

Sync state associated with this sync down.

Declared In

SFMobileSyncSyncManager.h

– syncDownWithTarget:soupName:updateBlock:

Create and run a sync down that overwrites modified records.

- (nullable SFSyncState *)syncDownWithTarget:(SFSyncDownTarget *)target soupName:(NSString *)soupName updateBlock:(SFSyncSyncManagerUpdateBlock)updateBlock

Parameters

target

Sync down target that will manage the sync down process.

soupName

Soup name where the local entries are stored.

updateBlock

Block to be called with updates.

Return Value

Sync state associated with this sync, or nil if it could not be created.

Declared In

SFMobileSyncSyncManager.h

– syncDownWithTarget:options:soupName:updateBlock:

Create and run a sync down.

- (nullable SFSyncState *)syncDownWithTarget:(SFSyncDownTarget *)target options:(SFSyncOptions *)options soupName:(NSString *)soupName updateBlock:(SFSyncSyncManagerUpdateBlock)updateBlock

Parameters

target

Sync down target that manages the sync down process.

options

Options associated with this sync down. Use this parameter to specify how the sync should handle modified records in the store.

soupName

Soup name where the local entries are stored.

updateBlock

Block to be called with updates.

Return Value

Sync state associated with this sync, or nil if it could not be created.

Declared In

SFMobileSyncSyncManager.h

– syncDownWithTarget:options:soupName:syncName:updateBlock:error:

Create and run a named sync down.

- (nullable SFSyncState *)syncDownWithTarget:(SFSyncDownTarget *)target options:(SFSyncOptions *)options soupName:(NSString *)soupName syncName:(nullable NSString *)syncName updateBlock:(SFSyncSyncManagerUpdateBlock)updateBlock error:(NSError **)error

Parameters

target

Sync down target that will manage the sync down process.

options

Options associated with this sync down. Use this parameter to specify how the sync should handle modified records in the store.

soupName

Soup name where the local entries are stored.

syncName

Name for this sync.

updateBlock

Block to be called with updates.

error

Sets error if sync could not be created.

Return Value

Sync state associated with this sync, or nil if it could not be created.

Declared In

SFMobileSyncSyncManager.h

– reSync:updateBlock:error:

Perform a resync.

- (nullable SFSyncState *)reSync:(NSNumber *)syncId updateBlock:(SFSyncSyncManagerUpdateBlock)updateBlock error:(NSError **)error

Parameters

syncId

Sync ID.

updateBlock

Block to be called with updates.

error

Sets error if sync could not be started.

Return Value

Sync state associated with this sync, or nil if it could not be started.

Declared In

SFMobileSyncSyncManager.h

– reSyncByName:updateBlock:error:

Perform a resync by name.

- (nullable SFSyncState *)reSyncByName:(NSString *)syncName updateBlock:(SFSyncSyncManagerUpdateBlock)updateBlock error:(NSError **)error

Parameters

syncName

Sync name.

updateBlock

Block to be called with updates.

error

Sets error if sync could not be started.

Return Value

Sync state associated with this sync, or nil if it could not be started.

Declared In

SFMobileSyncSyncManager.h

– createSyncUp:options:soupName:syncName:

Create a sync up without running it.

- (SFSyncState *)createSyncUp:(SFSyncUpTarget *)target options:(SFSyncOptions *)options soupName:(NSString *)soupName syncName:(nullable NSString *)syncName

Parameters

target

Sync up target that will manage the sync up process.

options

Options associated with this sync up. Use this parameter to specify how the sync should handle modified records on the server.

soupName

Soup name where the local entries are stored.

syncName

Name for this sync.

Return Value

Sync state associated with this sync up.

Declared In

SFMobileSyncSyncManager.h

– syncUpWithOptions:soupName:updateBlock:

Create and run a sync up with the default SFSyncUpTarget.

- (nullable SFSyncState *)syncUpWithOptions:(SFSyncOptions *)options soupName:(NSString *)soupName updateBlock:(SFSyncSyncManagerUpdateBlock)updateBlock

Parameters

options

Options associated with this sync up. Use this parameter to specify how the sync should handle modified records on the server.

soupName

Soup name where the local entries are stored.

updateBlock

Block to be called with updates.

Return Value

Sync state associated with this sync, or nil if it could not be created.

Declared In

SFMobileSyncSyncManager.h

– syncUpWithTarget:options:soupName:updateBlock:

Create and run a sync up with the configured SFSyncUpTarget.

- (nullable SFSyncState *)syncUpWithTarget:(SFSyncUpTarget *)target options:(SFSyncOptions *)options soupName:(NSString *)soupName updateBlock:(SFSyncSyncManagerUpdateBlock)updateBlock

Parameters

target

Sync up target that will manage the sync up process.

options

Options associated with this sync up. Use this parameter to specify how the sync should handle modified records on the server.

soupName

Soup name where the local entries are stored.

updateBlock

Block to be called with updates.

Return Value

Sync state associated with this sync, or nil if it could not be created.

Declared In

SFMobileSyncSyncManager.h

– syncUpWithTarget:options:soupName:syncName:updateBlock:error:

Create and run a named sync up.

- (nullable SFSyncState *)syncUpWithTarget:(SFSyncUpTarget *)target options:(SFSyncOptions *)options soupName:(NSString *)soupName syncName:(nullable NSString *)syncName updateBlock:(SFSyncSyncManagerUpdateBlock)updateBlock error:(NSError **)error

Parameters

target

Sync up target that will manage the sync up process.

options

Options associated with this sync up. Use this parameter to specify how the sync should handle modified records on the server.

soupName

Soup name where the local entries are stored.

syncName

Name for this sync.

updateBlock

Block to be called with updates.

error

Sets error if sync could not be created.

Return Value

Sync state associated with this sync, or nil if it could not be created.

Declared In

SFMobileSyncSyncManager.h

– cleanResyncGhosts:completionStatusBlock:error:

Remove local copies of records that have been deleted on the server or do not match the query results on the server anymore.

- (BOOL)cleanResyncGhosts:(NSNumber *)syncId completionStatusBlock:(SFSyncSyncManagerCompletionStatusBlock)completionStatusBlock error:(NSError **)error

Parameters

syncId

Sync ID.

completionStatusBlock

Completion status block.

error

Sets error if clean operation could not be started.

Return Value

YES if cleanResyncGhosts started successfully.

Declared In

SFMobileSyncSyncManager.h

– cleanResyncGhostsByName:completionStatusBlock:error:

Remove local copies of records that have been deleted on the server or do not match the query results on the server anymore.

- (BOOL)cleanResyncGhostsByName:(NSString *)syncName completionStatusBlock:(SFSyncSyncManagerCompletionStatusBlock)completionStatusBlock error:(NSError **)error

Parameters

syncName

Sync Name.

completionStatusBlock

Completion status block.

error

Sets error if clean operation could not be started.

Return Value

YES if cleanResyncGhosts started successfully.

Declared In

SFMobileSyncSyncManager.h

SFSyncTask Methods

– addToActiveSyncs:

- (void)addToActiveSyncs:(SFSyncTask *)syncTask

– removeFromActiveSyncs:

- (void)removeFromActiveSyncs:(SFSyncTask *)syncTask