Storage from @ionic/storage loses data
See original GitHub issueFrom @Lafaa on October 30, 2016 16:29
Hi guys! Am i the only one having problem with the new Storage since the ionic2 rc0?
It just forgets everything once the app is restarted. I use the Storage class from @ionic/storage to save username and password, but it’s like it get cleaned on app restart.
I’m using the Storage this way:
public storage: Storage;
...
this.storage = new Storage();
...
this.storage.set(key, value);
I’ve also added the Storage in app.module.ts, both in the import section AND in the providers array. Did i get something wrong? In the running and building process i don’t have any error or warnings
Cordova CLI: 6.3.1 Ionic Framework Version: 2.0.0-rc.0-201610131811 Ionic CLI Version: 2.1.0 Ionic App Lib Version: 2.1.0-beta.1 OS: Node Version: v6.7.0
Copied from original issue: driftyco/ionic#8959
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Data lost when using ionic/storage
I'm using import { Storage } from '@ionic/storage'; to make iOS app. Some users report their data is lost after a few days...
Read more >Data lost when using ionic/storage - Angular - TBRG Discourse
I was using “@ionic/Storage” for saving many metadatas in the POS application. In some cases there were issues where the data is missing ......
Read more >Storing mobile apps data to avoid data loss - Stack Overflow
Currently, it stores data in local storage (ionic storage) and when everything is filled it stores data to MongoDB. but some users have...
Read more >Choosing the Right Data Storage Solution - Ionic.io
Explore Ionic data storage options: Ionic Storage, Capacitor Storage, plain SQLite storage, and Ionic's Secure Storage solution.
Read more >Ionic 4 - Save and Retrieve Data Locally on Device - Enappd
Storage is an easy way to store key/value pairs and JSON objects. Storage uses a variety of storage engines underneath, picking the best...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am wrapping everything inside platform.ready() as you can see below, and the get returns null everytime.
I’ve seen that @mirkonasato has submitted a pull request for this here #21 . Please @jgw96, could you take a look?
I am using ionic 2.1.8, cordova 6.3.1, ionic storage 1.1.6 and cordova-sqlite-storage 1.5.0.
Thanks!
Fixed with #21