function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Riadh MRiadh M 

Is there any alternative to SmartStore for persistent storage?

Hi,
I'm looking for a way to store Salesforce data locally in a mobile device. Smartstore is awesome, but the problem it deletes all Soups when we logout of the app. I reallly need to keep data on the mobile device even after logout.

Is there any alternative to Salesforce SmartStoe to do this ?

Thanks.
Ashish_SFDCAshish_SFDC
Hi , 


Looks like this is currently not possible, 

See the links below, 

Offline Storage

Offline storage is something I haven’t really worked with at all as a developer. I had read a bit and toyed with CoreData, Apple’s persistence framework, but nothing on a production level scale. Perhaps the most interesting piece of information about the Salesforce Mobile SDK’s implementation of offline storage was that they were leveraging an alternative to CoreData, rather than wrapping CoreData itself. They called this SmartStore, and it also sits on top of an SQLite database. Here is a good article by Model Metrics about it.

While most documentation regarding SmartStore references its use for Hybrid applications, it is also available for native applications as well. That is where I spent some time trying to figure out what the use cases were for a native developer to use SmartStore rather than CoreData, considering CoreData is the standard for local storage. I found a Salesforce blog that boiled it down to using SmartStore on native applications primarily to maintain parity with any Hybrid applications, but am still curious if there are any other benefits regarding performance or any other metrics (e.g. ease of use). From my brief work leveraging it, it didn’t necessarily seem any easier than using CoreData.

http://michaelwelburn.com/2013/02/25/ios-development-with-salesforce-com-sdk-day-1-thoughts/


Using SmartStore with Native iOS

https://developer.salesforce.com/blogs/developer-relations/2012/11/using-smartstore-with-native-ios.html


Storing Data Offline with Salesforce Mobile SDK SmartStore

https://developer.salesforce.com/forums/ForumsMain?id=906F000000098xlIAA


Sync smartStore offline Data to Salesforce DB

http://stackoverflow.com/questions/20089789/sync-smartstore-offline-data-to-salesforce-db


Regards,
Ashish
Jacques LefebvreJacques Lefebvre
Hi,

Is there any new development on this issue of clearing the db after logout?
If the user session expire, I suppose a logout clean is performed?

Any new solution to address this issue?

Regards

Jacques
Steve ThistleSteve Thistle
Hi Jacques,

If you want to store data in the smartstore persistently you can use the global smartstore. This is not tied to a user account. The app developer is responsible for clearing the glable store when the data is no longer needed. 
See https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/offline_global_smartstore.htm

Care must be taken when using this to ensure you don't store specific user data. From the link above
"Do not store user-specific data in global SmartStore. Doing so violates Mobile SDK security requirements because user data can persist after the user logs out."