Is AsyncStorage shared across apps?

2020-06-16 03:33发布

问题:

My question originates from the docs: https://facebook.github.io/react-native/docs/asyncstorage.html#clear

AsyncStorage.clear -> Erases all AsyncStorage for all clients, libraries, etc....

does that mean that all apps share the same AsyncStorage?

回答1:

AsyncStorage is not shared between multiple apps. Every app runs it it's own sandbox environment and has no access to other apps.

To call AsyncStorage.clear only means you will delete all data which your app has stored in AsyncStorage.

That includes

  • all data which was stored by a library that uses AsyncStorage like https://github.com/sunnylqm/react-native-storage
  • all data from all users (in case of multi user)

For more information about app sandboxing you can read this answer: What is Sandbox in ios , Can i Trans data between in one App to Another App in iPhone,if possible how