我正在使用 PouchDb (无复制)开发一个 Ionic 应用程序。我能够成功地存储带有附件的数据。
为了检索数据,我使用下面的控制器片段来调用 angularjs 工厂中的 get 函数,
pouchDbManager.getData(currentSongIdx).then(function(result) {
$scope.songs.push({title:result.title,image:result.image});
audioFile=$sce.trustAsUrl("data:audio/mp3;base64,"+result._attachments.song.data);
$scope.playCurrentSong(audioFile);
if(result.sermon_favourite == 1) {$scope.favourited = 1}
});
工厂片段如下
.factory('pouchDbManager', function($q) {
......
function getData(id){
return $q.when(_db.get(id,{attachments: true}));
}
......
}
上面的代码片段在我的 Chrome 浏览器中完美运行,返回数据和预期的附件。但是当我构建项目并在我的 Android 设备上运行它时,没有返回任何数据。
通过一些控制台日志记录,我发现工厂中的 getData 函数没有返回数据。
我还使用了 pouchdb.get(id) 和 pouchdb.getAttachment(id, filename)。
虽然这两个函数在 Chrome 上也能正常工作,但 pouchdb.getAttachment 未能在我的 Android 设备上返回预期的附件。
附件存储在base64中,大约10-15mb
有人经历过这个问题吗?请帮忙
我正在使用 Ionic、AngularJs、Pouchdb 5.3.1、Cordova、Android 4.4.2 和 2GB RAM 进行开发。