Cordova / Ionic database(Web SQL) disappears randomly

偶尔善良 提交于 2020-01-16 16:48:09

问题


A Cordova/Ionic app I've built is having a little trouble. The problem is only appearing on one user's phone (out of about 6 different phones)

Essentially when randomly using the app, sometimes the user will return to the app to find the database / state is completely blank. I have a function that they can trigger to send me the entire db, and it's as if it just randomly resets itself. There is a single call to reset the database, but it is behind a yes/no prompt so I don't think it's user error.

The problem has pretty started last week, where the provisioning profile of the app (we are using enterprise deployment for sharing the app with the testing team).

Is there any chance that that switch of profile could have left the phone is a slightly odd situation where the database could become unstable?


回答1:


The answer was insanely dumb.

The db of a websql database (and I presume local storage potentially as well) is stored in the library/caches directory, which is not garenteed to be persistent. I had read in a number of places that said it was safe to use.

It took me 2 hours to switch out to using the native db (via a localforage adapter).

Pouch db also knows how to use a real database.

Don't go down this route.



来源:https://stackoverflow.com/questions/30427531/cordova-ionic-databaseweb-sql-disappears-randomly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!