简体   繁体   English

Ionic App崩溃问题

[英]Ionic App crash issue

I am working on n Ionic app that uses localstorage for offline data store. 我正在使用将本地存储用于脱机数据存储的n Ionic应用程序。

There are about 30 templates in this app. 此应用程序中大约有30个模板。 Also any number of users can be added. 也可以添加任意数量的用户。 Local storage is used to store 3 things mostly. 本地存储主要用于存储3件东西。 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. 我的问题是,最近在iPhone 8和iPad上的iOS 8上都出现了内存崩溃问题。 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); 我使用了这段代码unescape(encodeURIComponent(JSON.stringify(localStorage)))。length); to find the size of local storage. 查找本地存储的大小。 It never goes beyond 2.5MB. 它永远不会超过2.5MB。 The major problem maybe the excessive manipulation on the localstorage data. 主要问题可能是对本地存储数据的过度操纵。

My query is should I use SQL Lite for this purpose. 我的查询是是否应为此目的使用SQL Lite。 If yes what are the best practices to use with cordova app. 如果是的话,那么什么是与cordova应用程序一起使用的最佳实践。 Would the use of SQL lite can cause more computional overhead ?? 使用SQL lite会导致更多的计算开销吗?

PS 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. PS我也考虑过使用javascript包装器进行本地存储管理(localstorageDB),但我认为在内部,它们也以提供抽象的方式进行处理。 Also we have same app on android but there is no memory problems on android. 另外,我们在android上有相同的应用程序,但是在android上没有内存问题。

Please provide your suggestions. 请提供您的建议。

You may want to have a look at two things: 您可能需要看两件事:

ngStorage - https://github.com/gsklee/ngStorage ngStorage- https://github.com/gsklee/ngStorage

SQLite - http://ngcordova.com/docs/#SQLite 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: 这是我在Ionic Framework中使用SQLite编写的教程:

https://www.thepolyglotdeveloper.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/ https://www.thepolyglotdeveloper.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/

Hopefully one of these solutions corrects your issues. 希望这些解决方案之一可以解决您的问题。

Regards, 问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM