Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.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/phonegap文件为什么?_Javascript_Android_Cordova_Phonegap Plugins - Fatal编程技术网

Javascript 未创建cordova/phonegap文件为什么?

Javascript 未创建cordova/phonegap文件为什么?,javascript,android,cordova,phonegap-plugins,Javascript,Android,Cordova,Phonegap Plugins,当我打开一个文件(cordova.plugins.fileOpener2.open……)时,手机会通知您没有找到该文件,但控制台中没有错误。有什么问题 window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) { //console.log(fileSystem.name); //console.log(fileSystem.root.na

当我打开一个文件(cordova.plugins.fileOpener2.open……)时,手机会通知您没有找到该文件,但控制台中没有错误。有什么问题

       window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
            //console.log(fileSystem.name);
            //console.log(fileSystem.root.name);
            //console.log(fileSystem.root.fullPath);
            fileSystem.root.getFile("test.txt", {create: true}, function(entry) {
                var fileEntry = entry;
               // console.log(entry.fullPath);
                entry.createWriter(function(writer) {
                    writer.onwrite = function(evt) {
                        console.log("some sample text");
                    };
                    writer.write("sample text");
                    writer.onwriteend = function(evt) {
                        $scope.pathFile = writer.localURL;
                        console.log($scope.pathFile);
                        cordova.plugins.fileOpener2.open(
                            $scope.pathFile,
                            'text',
                            {
                                error : function(e) {
                                    console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
                                },
                                success : function () {
                                    console.log('file opened successfully');
                                }
                            }
                        );
                    };
                }, function(error) {
                    console.log(error);
                });
            }, function(error){
                console.log(error);
            });
        },
        function(event){
            console.log( event.target.error.code );
        });

在检查文件之前将此测试设置为

    function onDeviceReady() {
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
    }

    function gotFS(fileSystem) {
        fileSystem.root.getFile("readme.txt", {create: true}, gotFileEntry, fail);
    }

    function gotFileEntry(fileEntry) {
        console.log("gotFileEntry");
    }

    function fail(evt) {
        console.log("Error : "+evt.code);
    }

控制台显示:gotFileEntry-好的,但问题仍然存在(((