Using the Sync Manager with Global SmartStore

To use Mobile Sync with a global SmartStore instance, call a static factory method on the sync manager object to get a compatible sync manager instance.

iOS
Swift
1SyncManager.sharedInstance(store: store!)
Objective-C
1+ (instancetype)
2    sharedInstanceForStore:
3        (SFSmartStore *)store;
Returns a sync manager instance that talks to the server as the current user and writes to or reads from the given SmartStore instance. Use this factory method for syncing data with the global SmartStore instance.
Android
1SyncManager getInstance(UserAccount account, String communityId, SmartStore smartStore);
Returns a sync manager instance that talks to the server as the given community user and writes to or reads from the given SmartStore instance. Use this factory method for syncing data with the global SmartStore instance.
Hybrid

In each of the following methods, the optional first argument tells the Mobile Sync plug-in whether to use a global store. This argument accepts a Boolean value or a StoreConfig object. If you use a StoreConfig object, you can specify storeName, isGlobalStore, or both, depending on your context. See Creating and Accessing User-based Stores.

  • 1syncDown(isGlobalStore, target, soupName, options, successCB, errorCB);
    2syncDown(storeConfig, target, soupName, options, successCB, errorCB);
  • 1reSync(isGlobalStore, syncId, successCB, errorCB);
    2reSync(storeConfig, syncId, successCB, errorCB);
  • 1syncUp(isGlobalStore, target, soupName, options, successCB, errorCB);
    2syncUp(storeConfig, target, soupName, options, successCB, errorCB);
  • 1getSyncStatus(isGlobalStore, syncId, successCB, errorCB);
    2getSyncStatus(storeConfig, syncId, successCB, errorCB);