这在我的浏览器中运行良好,但是当我在我的手机上安装应用程序并使用它时......它看起来很好,直到我强制它停止并重新打开应用程序,然后我的所有记录都消失了。
我使用的是 2.2 和 Phonegap....任何帮助将不胜感激。这是我的商店:
Ext.define('MyApp.store.Presentations', {
extend: 'Ext.data.Store',
config: {
model: 'MyApp.model.Presentations',
sorter: 'title',
grouper: function (record) {
var upperCased = record.get('title')[0].toUpperCase();
return upperCased; //First letter of the title - how we GROUP these
},
autoLoad: true,
proxy: {
type: 'localstorage',
id: 'presentations'
}
}
});
我这样保存:
var newPresentation = { title: prezTitle, content: '' };
Ext.getStore('Presentations').add(newPresentation);
var newRecord = Ext.getStore('Presentations').sync();
最佳答案
您可以尝试在 DroidGap 类中添加以下代码:
super.appView.getSettings().setAllowFileAccess(true);
super.appView.getSettings().setDatabaseEnabled(true);
super.appView.getSettings().setDatabasePath("/data/data/" + appView.getContext().getPackageName() + "/databases/");
super.appView.getSettings().setDomStorageEnabled(true);
这条线解决了我遇到的同样问题
关于android - 当应用程序停止使用 Sencha Touch 2.2 和 Phonegap 时,LocalStorage 存储不会持续存在于 Android 手机上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16240613/