使用cordova 2.8.1我正在尝试用photolibrary做一个camera.getPicture.它似乎适用于 Android但不适用于iOS.下面是我如何调用getPicture代码.在带有iOS 6的iPhone 4s上,它允许我选择一个图像,但是一旦完成
var options = {
quality : 30,
destinationType : Camera.DestinationType.FILE_URI,
sourceType : Camera.PictureSourceType.PHOTOLIBRARY,
correctOrientation: true,
targetWidth: 800,
targetHeight: 800
};
navigator.camera.getPicture(this.captureSuccessPre, this.captureError, options);
有人告诉我在console.logs周围添加一个超时.在phonegaps文档中,它声明围绕警报这样做.下面是我的错误回调.记录[错误空]
captureError: function(error){
setTimeout(function(){
console.log("error " + error); //logs error null
}, 100);
}
有人有主意吗.我一直在苦苦挣扎几天.如果它有助于任何这个代码完美的
sourceType : Camera.PictureSourceType.CAMERA,我有完全一样的问题;似乎与DestinationType.FILE_URI有关.
试试这个:
var options = {
quality : 30,
destinationType: navigator.camera.DestinationType.NATIVE_URI,
sourceType : Camera.PictureSourceType.PHOTOLIBRARY,
correctOrientation: true,
targetWidth: 800,
targetHeight: 800
};
