2

I am attempting to utilize the Ionic Storage library to keep track of settings for my app. However, I am having an issue where each time the app is restarted, the storage is wiped. At least, it appears that way.

I'm storing the data:

this.storage.set('language', 'es');

and attempting to retrieve:

this.storage.get('language').then((val) => {
      this.mylang = val;
    }).catch((errorGet: any) => {
      console.error(errorGet);
      return;
    });

Retrieving the data works if I don't quit the app. But if I quit and re-open, the data is gone. It is using SQLite as far as I can tell (per debug messages in XCode when building & testing there).

2 Answers2

0

I think it's an issue with Ionic-storage, you can check the issue here https://github.com/ionic-team/ionic-storage/issues/165 try to implement another solution SQLite or local storage

Rebai Ahmed
  • 1,509
  • 1
  • 14
  • 21
-1

The best way is to use back-end for persistent storage like Rest Full API or a database. In this way you can manage the storage problem(This is my suggestion).

Muhammad Ayyaz
  • 11
  • 1
  • 14