Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/446.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Cordova文件插件_Javascript_Android_Jquery_Cordova_Cordova Plugins - Fatal编程技术网

Javascript Cordova文件插件

Javascript Cordova文件插件,javascript,android,jquery,cordova,cordova-plugins,Javascript,Android,Jquery,Cordova,Cordova Plugins,为了使Cordova文件插件和Cordova文件传输正常工作,我正在竭尽全力,我下面的代码应该创建一个新文件夹“Makes”,并将图像下载到该新文件夹中,但它只是抛出错误代码1,但我不明白为什么,请有人给我指出正确的方向: function onAppReady(){ if(navigator.splashscreen && navigator.splashscreen.hide){ navigator.splashscreen.hide(); }

为了使Cordova文件插件和Cordova文件传输正常工作,我正在竭尽全力,我下面的代码应该创建一个新文件夹“Makes”,并将图像下载到该新文件夹中,但它只是抛出错误代码1,但我不明白为什么,请有人给我指出正确的方向:

function onAppReady(){
    if(navigator.splashscreen && navigator.splashscreen.hide){
        navigator.splashscreen.hide();
    }

    updateImages();
}


function updateImages(){
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, fileSystemSuccess, fileSystemFail);

    function fileSystemSuccess(fileSystem){
        var directoryEntry=fileSystem.root;
        directoryEntry.getDirectory("Makes", {create:true, exclusive:false}, onDirectorySuccess, onDirectoryFail);

    }
    function onDirectorySuccess(parent){
        var rootdir = fileSystem.root;
        var fp = parent.toURL(); 

        var download_link=encodeURI('https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1122px-Wikipedia-logo-v2.svg.png');
        var fpFull=fp+'Makes/Wikipedia.png';

        filetransfer(download_link, fpFull);
    }
    function onDirectoryFail(error){alert("Unable to create new directory: "+error.code);}
    function fileSystemFail(evt){alert(evt.target.error.code);}
}

function filetransfer(download_link, fp){
    var fileTransfer=new FileTransfer();
    fileTransfer.download(download_link, fp, function(entry){
        console.log("download complete: "+entry.fullPath);
    },
    function(error){
        console.log("download error: "+error.code+' - '+error.source+' - '+error.target);
    });
}

document.addEventListener("app.Ready", onAppReady, false);

那是什么错误?我得到了错误代码1,它是“FileTransferError.FILE\u NOT\u FOUND\u ERR”,但我看不出有什么问题。