I am working on n Ionic app that uses localstorage for offline data store.
There are about 30 templates in this app. Also any number of users can be added. Local storage is used to store 3 things mostly. First the primary information about users and last signed in user. Second latest notifications of the users to show on app start. Then user can refresh them from server. And also the Chats of the user .
My problem is that recently there was memory crash issue on iOS 8 both on iphone and ipad. In process to track down the problem's cause I disabled the local storage , then the memory warning didn't appear. So i am assuming local storage may be the cause of the problem. Also I think size of localstorage is not an issue. I used this code unescape(encodeURIComponent(JSON.stringify(localStorage))).length); to find the size of local storage. It never goes beyond 2.5MB. The major problem maybe the excessive manipulation on the localstorage data.
My query is should I use SQL Lite for this purpose. If yes what are the best practices to use with cordova app. Would the use of SQL lite can cause more computional overhead ??
P.S. I have also considered using javascript wrappers for localstorage management ( localstorageDB) but i think internally they also process the same way just providing an abstraction. Also we have same app on android but there is no memory problems on android.
Please provide your suggestions.
You may want to have a look at two things:
ngStorage - https://github.com/gsklee/ngStorage
SQLite - http://ngcordova.com/docs/#SQLite
It is weird that you're having issues, but then again you could be doing some crazy manipulations, more than you think.
Here is a tutorial I had written on SQLite in Ionic Framework:
http://blog.nraboy.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/
Hopefully one of these solutions corrects your issues.
Regards,