在使用cordova-plugin-file插件使用meteor 1.4构建的android应用程序中,不会触发像onloadend这样的filereader事件。
resolveLocalFileSystemURL(pathToFile, function(fileEntry) {
fileEntry.file(function(file) {
var reader = new FileReader();
reader.onloadend = function(event) {
// this event does not fire
console.log(event.target.result);
};
reader.readAsDataURL(file);
},function(error) {
console.log(error);
});
},function(error) {
console.log(error);
});
这个问题似乎与Can't read a file from android directory using cordova-plugin-file plugin有关
我尝试安装旧版本的文件插件,就像他们在那个问题中建议的那样
meteor add cordova:cordova-plugin-file@3.0.0
但是,当我运行我的应用程序时,它会自动安装更新版本的插件
WARNING: Attempting to install plugin cordova-plugin-file@3.0.0, but it should have a minimum version of 4.1.1 to ensure compatibility with the current platform versions. Installing the minimum version for convenience, but you should adjust your
dependencies.
可能是与流星 1.4 打包的 Cordova 版本不支持最新版本的 cordova-plugin-file。我可以以某种方式降级它或强制流星安装旧插件版本吗?