Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Managing Stores
iOS Native Apps
Mobile SDK for iOS defines the following SFSmartStore methods for removing stores.
- Swift
-
1func removeShared(withName: String) -> Void 2func removeShared(withName: String, forUserAccount: UserAccount) -> Void 3func removeSharedGlobal(withName: String) -> Void 4func removeAllForCurrentUser() -> Void 5func removeAll(forUserAccount: UserAccount) -> Void 6func removeAllGlobal() -> Void - Objective-C
-
1+ (void)removeSharedStoreWithName:(NSString *)storeName; 2+ (void)removeSharedStoreWithName:(NSString *)storeName forUser:(SFUserAccount *)user; 3+ (void)removeSharedGlobalStoreWithName:(NSString *)storeName; 4+ (void)removeAllStores; 5+ (void)removeAllStoresForUser:(SFUserAccount *)user; 6+ (void)removeAllGlobalStores;
1+ (NSArray *)allStoreNames;
2+ (NSArray *)allGlobalStoreNames;Android Native Apps
Mobile SDK for Android defines the following SmartStoreSDKManager methods for removing stores.
1public void removeGlobalSmartStore(String dbName)
2public void removeSmartStore()
3public void removeSmartStore(UserAccount account)
4public void removeSmartStore(UserAccount account, String communityId)
5public void removeSmartStore(String dbNamePrefix, UserAccount account, String communityId)1public List<String> getGlobalStoresPrefixList()
2public List<String> getUserStoresPrefixList()Hybrid Apps
1removeStore(storeConfig,successCB, errorCB)
2removeAllGlobalStores(successCB, errorCB)
3removeAllStores(successCB, errorCB)1getAllStores(successCB, errorCB)
2getAllGlobalStores(successCB, errorCB)
3getAllStores(successCB, errorCB)
4getAllGlobalStores(successCB, errorCB)Removing All SmartStore Data at Runtime
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:
- Drop the sync managers associated with the current user.
- iOS
-
- Swift
- Call the following SyncManager
method:
1func removeSharedInstance(user: UserAccount) -> Void - Objective-C
- Call the following SFMobileSyncSyncManager
method:
1+ (void)removeSharedInstance:(SFUserAccount*)user;
- Android
- Call the following MobileSyncSyncManager
method:
1public static synchronized void reset(UserAccount account)
- Drop the stores associated with the current user.
- iOS
-
- Swift
- Call the following SmartStore
method:
1func removeAll(forUserAccount: UserAccount) -> Void - Objective-C
- Call the following SFSmartStore
method:
1+ (void)removeAllStoresForUser:(SFUserAccount *)user;
- Android
- Call the following SmartStoreSDKManager
method:
1public void removeAllUserStores()