TheCocoaProject / cordova-plugin-nativestorage

Cordova plugin: Native storage of variables in Android, iOS and Windows
http://thecocoaproject.github.io/
Apache License 2.0
292 stars 106 forks source link

Outdated values after installing new version of the app #157

Open CodeWithOz opened 3 years ago

CodeWithOz commented 3 years ago

Sometimes when I install a new version of the app, some values I retrieve are not up to date. The keys contain values from several days before, instead of the most recent values from a few hours before. As a simple example, consider this:

// after initializing the app
const now = Date.now(); // assume the value is 1000000000000
NativeStorage.setItem('lastOpenTime', now);

a few hours later after I open the app again

NativeStorage.getItem('lastOpenTime', value => {
  console.log(value === 1000000000000); // true
  const now = Date.now(); // assume the value is now 2000000000000
  NativeStorage.setItem('lastOpenTime', now);
});

the next day after I open the app again

NativeStorage.getItem('lastOpenTime', value => {
  console.log(value === 2000000000000); // false
  console.log(value === 1000000000000); // true
  ...
});

So the idea is that for some reason the value saved for lastOpenTime reverts to 1000000000000 even after it's been updated to 2000000000000. Any idea as to what could be causing this?