localStorage的可靠性的PhoneGap [英] LocalStorage Reliability with Phonegap

查看:141
本文介绍了localStorage的可靠性的PhoneGap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做的PhoneGap应用程序,需要存储一些用户数据。在初始应用程序启动时,用户将被要求输入一个URL。由于URL可能可能会很长,我希望把它保存在用户的设备上所以他不需要重新输入整个字符串他每次启动应用程序。

I'm making a PhoneGap app that needs to store some user data. On the initial app startup, the user will be asked to type in a URL. Because the URL may potentially be long, I wish to save it on the user's device so the he doesn't need to re-enter the entire string every time he starts up the app.

起初,我打算使用localStorage的这一点。不过,我听说localStorage的不保存数据非常久治不愈。这将极大地伤害我的应用程序的可用性,如果用户不得不在URL中每月一次或让更多的输入。

Initially, I was planning on using LocalStorage for this. However, I've heard that LocalStorage doesn't save data very permanently. It would greatly hurt my app's usability if the user had to type in the URL more than once every month or so.

我应该使用SQLite,而不是localStorage的用于此目的,或者说是对的localStorage大多数移动设备足够可靠为这种用法?

Should I use SQLite instead of LocalStorage for this purpose, or is LocalStorage reliable enough on most mobile devices for this kind of usage?

推荐答案

您should'nt使用localStorage的,因为它不再IOS一个持续性的存储,因为5.1和也因为苹果可以拒绝你的申请。

You should'nt use LocalStorage because it's no longer a persistant storage on IOS since 5.1 and also because Apple can reject your application.

您有几种选择:

  • Using the File API
  • Using WebSQL (5 Mo max i think)
  • Installing the SQLite Plugin

对于最后的选择,也可以安装 Lawnchair <​​/A>(包括),它提供了一个易于在SQLite的顶部用核心价值体系。您不需要编写任何SQL线使用SQLite。

For the last choice, you can also install Lawnchair (included) which provides an easy to use key value system on top of SQLite. You won't need to write any line of SQL to use SQLite.

这篇关于localStorage的可靠性的PhoneGap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆