Preserving data in SQlite

Thread is closed for posting
2 posts, 0 answers
  1. Per
    Per avatar
    1 posts
    Member since:
    Dec 2016

    Posted 06 Jan 2017 Link to this post

    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

     

     

     

  2. Martin
    Admin
    Martin avatar
    104 posts

    Posted 10 Jan 2017 Link to this post

    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.

     
Back to Top