【发布时间】:2018-01-25 08:05:28
【问题描述】:
在我的 Cordova 基础应用程序“硬”关闭后,PouchDB 数据将被删除。
步骤如下:
- 安装应用程序
- 在 PouchDB 名称测试中保存一些数据
- 验证数据是否已保存
- 关闭应用程序(在 iOS 上双击 hone 按钮)
- 重新打开应用
- 验证保存丢失
这只发生在第一次安装时
作为测试,我使用示例代码在表单上创建了两个按钮
$scope.saveme=function(){
var db =new PouchDB("test");
var todo = {
_id: new Date().toISOString(),
title: "test",
completed: false
};
db.put(todo, function callback(err, result) {
if (!err) {
alert('Successfully posted a todo!');
}
else{
alert(err);
}
});
}
$scope.showme = function(){
var db =new PouchDB("test");
db.allDocs({include_docs: true, descending: true}, function(err, doc)
{
alert(JSON.stringify(doc));
});
}
ios 版本:4.5.4 科尔多瓦:6.5 小袋:6.4.1
请告诉我如何解决这个问题
【问题讨论】:
标签: ios cordova pouchdb cordova-ios