This is a migrated thread and some comments may be shown as answers.

Preserving data in SQlite

1 Answer 30 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Per
Top achievements
Rank 1
Per asked on 06 Jan 2017, 04:29 PM

Using the Sqlite sample app I noticed that after building and deploying a second time in Appbuilder existing data are gone.

Will this also happen after updating an app deployed to appstore?  If so, how can data be preserved?

Thanks

 

 

 

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 10 Jan 2017, 02:56 PM
Hi Per,

On iOS when you distribute updates of the app, the file in the bundle is replaced/updated, but the user's copy in the Documents or Library folder stays there unless you explicitly remove it programmatically (or the user manually uninstalls the app). Therefore updating your application won't delete the database file stored in the documents or library directory (but if it is in your bundle, it'll be removed).

To store the SQLite file in the documents or library forlders, upon creating/opening the database in your app you may set iosDatabaseLocation: 'Library' .

Additionally, Apple's file system programming guide for iOS describes the (application_home)/Library path as a place to "create custom subdirectories for files you want backed up but not exposed to the user". The (application_home)/Documents path is described as "the contents of this directory can be made available to the user through file sharing."

You may further review the file system programming guide for iOS here.

Regards,
Martin
Telerik by Progress
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
General Discussion
Asked by
Per
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or