2012-06-22 82 views
2

我想在PhoneGap的(IOS)刪除圖像,所以我呼籲:entry.remove(成功,失敗)調用成功,但不刪除圖像

window.resolveLocalFileSystemURI(imageURI, ok, no); 

這個調用OK功能

function ok(entry) { 
      alert("Deleting: " + entry.name); 
      entry.remove(); 
     } 

所以一切都按計劃進行,但我的圖像仍然顯示在我的圖書館。我究竟做錯了什麼?

完整的源:

window.resolveLocalFileSystemURI(imageURI, ok, no); 
     function ok(entry) { 
      alert("Delete file entry: " + entry.name); 
      entry.remove(pictureRemoved, notRemoved); 
     } 
     function pictureRemoved(){ 
      alert('removed'); 
     } 
     function notRemoved(){ 
      alert('not Removed'); 
     } 
     function no(error) { alert 
     ("resolveFileSystemURI failed: " + error.code); } 

回答

0

嘗試用下面的代碼:

//Delete file 
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, 
    function(fileSys) { 

     fileSys.root.getFile(imageURI, {create: false}, 
      function(file) { 
       file.remove(pictureRemoved, notRemoved);             
      }, no); 
    }, no); 

它爲我工作。

+0

舉個完整的例子 – Patel

0

添加文件插件。它會工作。