Managing Stores
If you create global stores, you’re required to perform cleanup when the app exits. Also, if you create multiple user stores, you can perform cleanup if you’re no longer using particular stores. SmartStore provides methods deleting named and global stores. For hybrid apps, SmartStore also provides functions for getting a list of named stores.
Mobile SDK for iOS defines the following SFSmartStore
methods for removing stores.
In addition, SmartStore provides the following methods for retrieving store names. Use this method for both Swift and Objective-C apps.
Mobile SDK for Android defines the following SmartStoreSDKManager
methods for removing stores.
In addition, SmartStore provides the following methods for retrieving store names.
SmartStore defines the following functions for removing stores. Each function takes success and error callbacks. The removeStore()
function also requires either a StoreConfig
object that specifies the store name, or just the store name as a string.
In addition, the hybrid version of SmartStore provides the following functions for retrieving the StoreConfig
objects for defined stores.
Sometimes an app must remove all data in a store without logging out the current user. In this case, keep in mind that the sync manager object sets up a table to track syncs. If you delete this table, the manager can’t continue. Therefore, the recommended way to reset SmartStore to a zero-data state is as follows:
Swift
Call the following SyncManager
method:
Objective-C
Call the following SFMobileSyncSyncManager
method:
Call the following MobileSyncSyncManager
method:
Swift
Call the following SmartStore
method:
Objective-C
Call the following SFSmartStore
method:
Call the following SmartStoreSDKManager
method: