0
我使用下面的代碼由所述navigator.camera.getPicture API調用:PhoneGap的2.2的moveTo()失敗給exec回調
function getImageURI(imageURI) {
//resolve file system for image to move.
window.resolveLocalFileSystemURI(imageURI, gotPicture, function(error) {onfail(error,'Get Target Image');});
function gotPicture(targetImg) {
//move the image into the post_(n) directory.
targetImg.moveTo(Globals.POSTDIR_OBJ,Utils.getImageName(), moveSuccess2, function(error){alert('Move Error')});
function moveSuccess2(){
alert('addPicture moveSuccess');
//update the picture counts in the client and DB.
Globals.pictCount++;
updateFilesById();
setTimeout("Gallery.show()",500);
};
}; //gotPicture
}; //getImageURI
問題是的時間約30%既不是成功還是失敗回調函數被調用。
此舉實際上每次都成功,但成功功能無法執行大約1/3的時間。