I am currently working on an Ionic2 app. I need to store some questions for users in localstorage. the questions json is ~70kb (when saved as .txt on desktop). It is working fine on desktop. But when viewing on IOS, the localstorage is trimmed, and not showing full value.
You can see the three dots in bottom part of image.
Can someone please guide me whats going wrong here. I am using localStorage.setItem("question_data",JSON.stringify(data));
.
Please try to use ionic's Storage
, it will use sqlite instead of localStorage on Android and iOS.
Storage is an easy way to store key/value pairs and JSON objects. Storage uses a variety of storage engines underneath, picking the best one available depending on the platform. When running in a native app context, Storage will prioritize using SQLite, as it's one of the most stable and widely used file-based databases, and avoids some of the pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such data in low disk-space situations.
Here is the documentation: http://ionicframework.com/docs/v2/storage/