Closed scottwio closed 5 months ago
When using AsyncStorage on iOS, I can not store strings larger than around 1024 characters. Doing so simply stores null. This is easily recreated try to store a large string in your app
AsyncStorage.setItem('MY_STRING', Array(1050).fill('a').join(''));
Doing so will give you a manifest containing
{"MY_STRING":null}
saving just 1000 characters however with
AsyncStorage.setItem('MY_STRING', Array(1000).fill('a').join(''));
Will give you
{"MY_STRING":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}
"@react-native-async-storage/async-storage": "1.21.0", "react": "18.2.0", "react-native": "0.73.3"
System: OS: macOS 14.1.1 CPU: (10) arm64 Apple M1 Max Memory: 3.56 GB / 64.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.10.0 path: ~/.asdf/installs/nodejs/20.10.0/bin/node Yarn: version: 1.22.19 path: /opt/homebrew/bin/yarn npm: version: 10.2.3 path: ~/.asdf/plugins/nodejs/shims/npm Watchman: version: 2023.11.06.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /Users/xxxxx/.asdf/shims/pod SDKs: iOS SDK: Platforms:
1.21.0
Can reproduce by following the steps above
Example repo using expo here, doesn't need to be an expo project though
https://github.com/scottwio/expo-async-storage
Manifest holds values with strings.length < 1024. Bigger values are stored in dedicated files
What happened?
When using AsyncStorage on iOS, I can not store strings larger than around 1024 characters. Doing so simply stores null. This is easily recreated try to store a large string in your app
Doing so will give you a manifest containing
saving just 1000 characters however with
Will give you
Deps
"@react-native-async-storage/async-storage": "1.21.0", "react": "18.2.0", "react-native": "0.73.3"
System
System: OS: macOS 14.1.1 CPU: (10) arm64 Apple M1 Max Memory: 3.56 GB / 64.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.10.0 path: ~/.asdf/installs/nodejs/20.10.0/bin/node Yarn: version: 1.22.19 path: /opt/homebrew/bin/yarn npm: version: 10.2.3 path: ~/.asdf/plugins/nodejs/shims/npm Watchman: version: 2023.11.06.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /Users/xxxxx/.asdf/shims/pod SDKs: iOS SDK: Platforms:
Version
1.21.0
What platforms are you seeing this issue on?
Steps to Reproduce
Can reproduce by following the steps above
Example repo using expo here, doesn't need to be an expo project though
https://github.com/scottwio/expo-async-storage