最近我发现我不能再从我的应用程序(iOS)上传图片和视频了。经查,window.resolveLocalFileSystemURL函数总是失败,返回{"code":5}。但是,直到最近它都运行良好,我没有遇到 Android 的这个问题。我的代码如下:
$('#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)); });
}
变量文件类似于 file:///var/mobile/Containers/Data/Application/UID/tmp/cdv_photo_021.jpg
你知道我应该怎么做才能让它工作吗?