-
Notifications
You must be signed in to change notification settings - Fork 467
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
[iOS] AsyncStorage data persists after uninstalling and re-installing app #342
Comments
Interesting. I did just a quick check (init new app, add AsyncStorage, save data, removed app, installed again, read data) and the data is indeed removed. |
I have the same problem on IOS simulator when i'm using React Native Debugger. If i disable debug mode, all is fine. |
My issue was on simulator as well (XCode 11.3) |
I have this problem using expo 37 + react native 61.4. |
Can anyone provide a project where issue is reproducible ? |
I've run into this as well on a physical iOS device, using:
Project repo is private, but I can provide more details upon request. App name is Serenity: Guided Mental Health. |
@JacquesLeupin Please do include some repro steps, thanks! |
How can we maintain this behaviour? I have a scenario where it's imperative that the data in AsyncStorage can be persisted across uninstalls/reinstalls. This is because a unique device ID is stored within it. |
@developius maybe storing your device id in keychain solve your problem. I also think that clearing data after app uninstall is important to avoid accumulation of garbage... |
@JacquesLeupin were you able to fix this? |
@nishanttatva nope, i never found a fix for this issue. our app uses firebase for auth, and we refactored to avoid storing most data in |
@exotexot good call, thanks! |
Since we're storing data in We need a way to opt out from doing that. Going to work on that in upcoming days |
Were you able to find anything? |
We also need this fix as it causes problems when users try to uninstall/reinstall (particularly noticeable when trying to experience a First-App-Launch experience)! This is a pretty urgent issue for our Application, so I'd love to help. There's a filesystem flag that can be set on files to enable/disable this type of behavior on iOS. @krizzu do you need any help getting a solution for this? From an API perspective @krizzu, what did you want for this? Solutions that come to mind:
|
I've created an initial PR that has backup feature toggling. I cannot repro this myself, so it'd be great if you (or anyone else) could give it a try. Regarding using that feature - I thought about adding an entry to |
@krizzu we'd be happy to try a beta build that has the final implementation of your proposed feature -- I've commented on your PR for now with some further thoughts. This is affecting our app in production, so we're comfortable testing an appropriate beta build in our normal QA process. |
Hello what is the status of this? It is interesting one IOS app is storing values correctly, and store is not persisted on reinstall. Another app the values are persisted on reinstall, so I'm wondering is it due to the fact "On iOS, AsyncStorage is backed by native code that stores small values in a serialized dictionary and larger values in separate files." That maybe this second app has larger values and is getting stored in a different place in the system? We are running into issues with this so I'm wondering the status. |
Any status on this? |
Any workaround to this issue? |
Also interested about this fix. @krizzu why is this closed? |
Ahh, my bad. We use expo-secure-store on some of our data, and they go into backup.
|
Any update on this PR? |
You can add following lines into your AppDelegate.mm file to clear Application Support directory on first launch:
Uncomment Oh, and don't forget to call it inside |
Thanks to you, I found the cause of the problem. |
Same problem, but in Android <= 10, the data still there after uninstall and reinstall the app. |
Current behavior
Using the latest stable release (1.9.0), AsyncStorage items that are set persist after an iOS app is uninstalled and then re-installed.
Expected behavior
AsyncStorage should be completely clear after uninstalling/reinstalling an app. This is how the framework bundled AsyncStorage behaves, so one would expect the community version to function the same way. If this persistence is intentional, it should be documented (as far as I can tell there is nothing in the docs that would explain this behavior, but I might have missed something). Apologies if I am mistaken or if this issue has been reported already.
Repro steps
AsyncStorage.setItem('someKey', 'someData');
const data = AsyncStorage.getItem('someKey'); // returns someData
Environment
The text was updated successfully, but these errors were encountered: