问题
I have a problem with plugin org-apache-cordova-file on Windows Phone. I'm trying to download and save a pdf from server. It's downloading it, but windows doesn't save this file. I received a error code 9 (INVALID_MODIFICATION_ERR). I turn on all capabilities which was necessary for file storage. Maybe someone have any idea how to solve this problem?
Edit:// I installed app on Android with same code and it works fine on this platform. I think there could be problem with some permissions to save file. On Android I can see app created a folder and inside it I found a file which should download from server.
回答1:
Insert this code (from here )
function writeFile(fileEntry, dataObj) {
// Create a FileWriter object for our FileEntry (log.txt).
fileEntry.createWriter(function (fileWriter) {
fileWriter.onwriteend = function() {
console.log("Successful file write...");
readFile(fileEntry);
};
fileWriter.onerror = function (e) {
console.log("Failed file write: " + e.toString());
};
// If data object is not passed in,
// create a new Blob instead.
if (!dataObj) {
dataObj = new Blob(['some file data'], { type: 'text/plain' });
}
fileWriter.write(dataObj);
});
}
Once you have your fileEntry, call writeFile. It should work on WP8
来源:https://stackoverflow.com/questions/45297286/invalid-modification-err-windows-phone