Extractzipfile插件有错误:在ios中找不到插件

时间:2013-04-05 04:39:25

标签: javascript iphone ios cordova phonegap-plugins

我正在尝试在“https://github.com/phonegap/phonegap-plugins/tree/master/iOS/ExtractZipFile”上为ios使用Extractzipfile插件。

但是当我在ios中使用这个插件时,显示错误:

2013-04-05 11:20:17.968 fileandzip[751:c07] ERROR: Plugin 'ExtractZipFilePlugin' not found, or is not a      CDVPlugin. Check your plugin mapping in config.xml.
  2013-04-05 11:20:17.969 fileandzip[751:c07] -[CDVCommandQueue executePending] [Line 103] FAILED   pluginJSON = [
    "ExtractZipFilePlugin733749280",
    "ExtractZipFilePlugin",
    "extract",
    [
      "test.zip",
      "\/Users\/alienware\/Library\/Application Support\/iPhone Simulator\/6.1\/Applications\/4BCA6B22-C582-  4529-92FF-4C7E54E82C18\/Documents\/ex"
    ]
  ]

我在公会档案中做了一切。有人帮我解决了!非常感谢...

修改

这是我的代码:

    <!DOCTYPE HTML>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <meta name="description" content="">
                <meta name="author" content="">
                    <link rel="stylesheet" href="css/jquery.mobile-1.1.1.min.css" />

                    <script src="cordova-2.5.0.js"></script>
                    <script src="js/jquery-1.7.2.min.js"></script>
                    <script src="js/jquery.mobile-1.1.1.min.js"></script>
                    <script src="js/jquery.xdomainajax.js"></script>
                    <script src="js/xml2json.js"></script>
                    <script src="js/ZipPlugin.js"></script>
                    <script src="js/jquery-ui.min.js"></script>
                    <script src="js/jquery.ui.touch-punch.min.js"></script>

                    <script type="text/javascript" charset="utf-8">

                        function onGetDirectorySuccess(dir) {
                            console.log("Created dir "+dir.name);
                        }

                        function onGetDirectoryFail(error) {
                            console.log("Error creating directory "+error.code);
                        }

                        var sa;
                        document.addEventListener("deviceready", onDeviceReady, true);

                        function onDeviceReady() {
                            console.log("device is ready");
                            window.requestFileSystem  = window.requestFileSystem || window.webkitRequestFileSystem;
                            window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
                            $('#import').click(function(){
                                               var ft = new FileTransfer();
                                               ft.download(
                                                           "http://smartphone.thnt.vn/VietGames/GhepTranhTu/test.zip",
                                                           window.rootFS.fullPath + "/ex/test.zip",
                                                           function(entry) {
                                                           window.alert("download complete: " + entry.fullPath);

                                                           },
                                                           function(error) {
                                                           console.log("download error" + error.code);
                                                           }
                                                           );
                            });
                            $('#unzip').click(function(){
                                               window.plugins.extractZipFile.extractFile('test.zip',window.rootFS.fullPath + '/ex',win,fail);
                                              function win(status)
                                              {
                                              window.alert('Success'+status);
                                              }

                                              function fail(error)
                                              {
                                              alert("error:" + error);
                                              }

                                              });

                        }

                        function fail() {
                            console.log("failed to get filesystem");
                        }

                        function gotFS(fileSystem) {
                            console.log("got filesystem");

                            // save the file system for later access
                            console.log(fileSystem.root.fullPath);
                            window.rootFS = fileSystem.root;
                            window.rootFS.getDirectory("ex", {create: true, exclusive: false}, onGetDirectorySuccess, onGetDirectoryFail);
                        }

                        </script> 
                    <style>
                        img {
                            max-width: 200px;
                        }
                        </style>
    </head>
    <body onload="init();" >
        <h2>Image Download Demo</h2>

        <div id="status"></div>

        <div id="photos">
            <canvas id="canvas" style="width:200;height:400;border: 1px solid #cc0000;"></canvas>
            <input id="unzip" type="button" value="unzip"/>
            <input id="import" type="button" value="import"/>
        </div>

    </body>
</html>

1 个答案:

答案 0 :(得分:0)

我认为您的设置中缺少

  

Cordova.plist (搜索此plist)部分中,您需要添加插件   键/对值:

     

ExtractZipFilePlugin()ExtractZipFilePlugin(