INVALID_MODIFICATION_ERR Windows手机 [英] INVALID_MODIFICATION_ERR windows phone

查看:326
本文介绍了INVALID_MODIFICATION_ERR Windows手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows Phone上遇到插件org-apache-cordova-file的问题。我正在尝试从服务器下载并保存pdf。它正在下载它,但Windows不保存此文件。我收到了错误代码9(INVALID_MODIFICATION_ERR)。我打开了文件存储所需的所有功能。也许有人知道如何解决这个问题?

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?

编辑://
我在Android上安装了相同代码的app,它在这个平台上运行正常。我认为保存文件的某些权限可能存在问题。在Android上,我可以看到app创建了一个文件夹,在里面我发现了一个应该从服务器上下载的文件。

// 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.

推荐答案

插入此代码(来自此处

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);
    });
}

获得fileEntry后,调用writeFile。它应该适用于WP8

Once you have your fileEntry, call writeFile. It should work on WP8

这篇关于INVALID_MODIFICATION_ERR Windows手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆