INVALID_MODIFICATION_ERR windows phone

丶灬走出姿态 提交于 2019-12-11 17:01:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!