Skip to content

Async Storage automatically cleared on iOS #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dylancom opened this issue Nov 23, 2019 · 12 comments
Closed

Async Storage automatically cleared on iOS #257

dylancom opened this issue Nov 23, 2019 · 12 comments

Comments

@dylancom
Copy link

dylancom commented Nov 23, 2019

Current behavior

I'm having multiple users report that they lost their app data (which is currently stored with AsyncStorage).
Somewhere I read that this could be due to saving too large stringified data under 1 key.
I used to save a whole redux store to 1 key in order to persist data but now I grouped data into separate keys. Still I'm having users report that they lose data after a while, so it doesn't seem related to a max string limit.

Is this related to some iOS behavior that auto clears up async storage?

Expected behavior

I expect that all data persists and doesn't get erased automatically.

Repro steps

It happens in some cases so it's hard to define the exact repro steps.

Environment

  • Async Storage version: v1.6.3
  • React-Native version: 0.61.4
  • Platform tested: iOS
@krizzu krizzu added the LEGACY label Nov 23, 2019
@krizzu
Copy link
Member

krizzu commented Nov 23, 2019

@dylancompanjen This looks like an issue that has been reported few times for iOS. It seems like using both Community AsyncStorage and the one from core. You can read my comment regarding here.

@dylancom
Copy link
Author

@krizzu I'm only using the Community AsyncStorage. Some folks said this happened after restarting their iPhone.

@krizzu
Copy link
Member

krizzu commented Nov 23, 2019

@dylancompanjen Sure, but it can happen that one (or more) of your dependencies uses Core's AsyncStorage, hence the condition race. Try finding reference in your node_modules.

@dylancom
Copy link
Author

@krizzu can't find a dependency that uses AsyncStorage in my node_modules.

@krizzu
Copy link
Member

krizzu commented Nov 26, 2019

@dylancompanjen Hmm, that's odd then. And only happens on phone restart? Did you mange to repro this?

@dylancom
Copy link
Author

@krizzu No, not necessarily on phone restart. Still getting reports from new users but I'm not sure how to repro it...

@nonewcode
Copy link

I'm not sure if this should be closed. Have this happening for me as well and looks like it may be the same issue on 2.0 where the log just randomly says "deleting store" without it being requested.

@krizzu
Copy link
Member

krizzu commented Dec 11, 2019

@codecog You're talking about the logger from v2?

@AndresAltomobile
Copy link

AndresAltomobile commented Jun 7, 2021

Any updates? I have users reporting the same, users are losing their data stored with AsyncStorage when they restart the application.

This only happens on iOS.

Repro steps

I was able to reproduce something similar
Close the app -> open the app via deep link -> the data that was stored with AsyncStorage disappears.

Environment

Async Storage version: ^1.15.5
React-Native version: 0.64.0
Platform tested: iOS

@igorjos
Copy link

igorjos commented Mar 15, 2022

Issue still persist with the latest version of the library on ios 15.3.1 and 15.4

@lorissikora
Copy link

Issue still perists. I've met this issue while using the library in a managed expo project. From what I experienced, it could be related to some under the hood racing issue. One kind-of-ish way to reproduce for me was to rapidly reload the app while using the expo dev server. This often caused the data to be lost.

@developeritsec
Copy link

i am facing the same issue on android
any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants