Pierre
Pierre

Reputation: 1246

window.resolveLocalFileSystemURL returns code 5

Recently I figured out that I could no more upload pictures and videos from my app (iOS). After investigation, the function window.resolveLocalFileSystemURL always fails and returns {"code":5}. However, it worked fine till recently and I do not meet that issue with Android. My code is as follow:

$('#take_picture').click(function(){
    navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 60, destinationType: Camera.DestinationType.FILE_URI, correctOrientation: true, targetHeight: 621, targetWidth: 621 });
});
$('#take_video').click(function(){
    var options = { limit: 1, quality: 0, duration: 10 };
    navigator.device.capture.captureVideo(onCaptureSuccess, onCaptureFail, options);
});

function onCaptureSuccess(mediaFiles) {
    var i, len;
    for (i = 0, len = mediaFiles.length; i < len; i += 1) { movePic(mediaFiles[i].fullPath); }
}

function onPhotoDataSuccess(imageURI) { 
    if (device.platform == 'iOS') { file = file.replace('/private/', 'file:///'); }
    movePic(imageURI);
}
function movePic(file){ 
    window.resolveLocalFileSystemURL(file, resolveOnSuccess, function(data){ alert(JSON.stringify(data)); }); 
} 

The variable file is like file:///var/mobile/Containers/Data/Application/UID/tmp/cdv_photo_021.jpg

Do you know what should I do to make it working?

Upvotes: 0

Views: 1183

Answers (1)

Pierre
Pierre

Reputation: 1246

Finally, I completely uninstalled/re-installed Phonegap, updated Cordova-ios and now this problem is solved, even without modifying any line of code.

Upvotes: -1

Related Questions