2014-02-22 63 views
0

科爾多瓦3.3回調突然停止工作。從2.9版升級到3.3版後,我對cordova的插件有些問題。在所有工作重新開始後,通過移除每個phonegap插件,並使用cordova命令行構建項目。但是,現在一些插件再次停止工作。見我的代碼如下相機和文件回調不工作科爾多瓦3.3

$("#getPicture").click(function(){ 
     navigator.camera.getPicture(gotPic, failHandler, 
      {quality:45, destinationType:navigator.camera.DestinationType.DATA_URL, 
      sourceType:navigator.camera.PictureSourceType.PHOTOLIBRARY, targetWidth: 270, targetHeight: 270}); 
}); 

function gotPic(data) { 
alert("in got pic") // doesn't get executed even if I set a timeout there 
} 

function failHandler(e){ 
    alert("in fail"); // same as above. 
} 

我得到了同樣的錯誤,當我請求文件系統

window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, gotFS, fail); 
     function gotFS(fileSystem) { 
    // create false before 
    alert("in gotFS"); 
    fileSystem.root.getFile(src, {create: false}, gotFileEntry, fail); 
} 

function gotFileEntry(fileEntry) { 
    alert("in entry"); 
    fileEntry.file(gotFile, fail); 
} 

function gotFile(file){ 
    alert("in gf"); 
    readDataUrl(file); 
} 

function readDataUrl(file) { 
    var reader = new FileReader(); 
    reader.onloadend = function(evt) { 
     alert("inside onloaded"); 
     base = evt.target.result; 
     alert("base " + base); 
    }; 
    reader.readAsDataURL(file); 

} 

function fail(error) { 
    alert(error.code); 
} 

這已經完美工作之前,我不明白爲什麼現在停止了。由於我一直在努力讓插件工作,我試圖刪除我的三個插件,但我搞砸了。

cordova plugin rm org.apache.cordova.camera 
cordova plugin rm org.apache.cordova.file-transfer 
cordova plugin rm org.apache.cordova.file 

兩個第一插件沒有任何問題得到去除,但是當我試圖刪除文件的插件我: 刪除插件org.apache.cordova.file 沒有懸掛插件刪除。

當我運行cordova插件ls時,插件仍然存在。

+0

文件是文件傳輸插件的依賴項,所以當您刪除文件傳輸時可能會自動刪除文件?問題是如果你想使用它,爲什麼要刪除插件? – QuickFix

+0

我以爲我需要再次添加插件。但是,我發現我的錯誤。我已經包含了兩次