调用resizeImage时出错:
2013-06-26 19:44:30.306 cascalho[13689:15b03] [LOG] Image Resizer Registered under window.imageResizer
2013-06-26 19:44:45.685 cascalho[13689:15b03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSDictionary initWithObjects:forKeys:]: count of objects (0) differs from count of keys (3)'
*** First throw call stack:
(0x171012 0x25c7e7e 0x17c737 0x19d8c2 0x627c 0x7563b 0x74d8c 0x7493d 0x74ad5 0x749f3 0x25db6b0 0x114a765 0xf4f3f 0xf496f 0x117734 0x116f44 0x116e1b 0x33f87e3 0x33f8668 0x3acffc 0x305c 0x2fb5)
libc++abi.dylib: terminate called throwing an exception代码捕获:
// capture either new or existing photo:
function capture(sourceType) {
navigator.camera.getPicture(onCaptureSuccess, onCaptureFail, { quality: 40,
destinationType: Camera.DestinationType.FILE_URI ,
sourceType: sourceType,
correctOrientation: true
}
);
};
var _imageURI =null;
// if photo is captured successfully, then upload to server:
function onCaptureSuccess(imageURI) {
_imageURI = imageURI;
var largeImage = document.getElementById('largeImage');
largeImage.style.display = 'block';
largeImage.src = imageURI;
};调用resizeImage的代码
window.imageResizer.resizeImage(
function(data) {
console.log("ah meu parana: ");
}, function (error) {
console.log("Error : \r\n" + error);
}, _imageURI,331 , 245, {
imageDataType: ImageResizer.IMAGE_DATA_TYPE_URL,
resizeType:ImageResizer.RESIZE_TYPE_PIXEL ,
format:'jpg'
}
);发布于 2014-04-07 22:36:55
我在当前的一个项目中遇到了类似的问题,我设法解决了这个问题。这个问题只出现在iOS设备上,特别是iPad,而不是我的Galaxy S3或安卓模拟器上。在传递给resizeImage之前,我从路径中删除了"file://“”,一切都正常了。
总而言之,更改以下内容:
window.imageResizer.resizeImage(success, failure, imageURI, 300, 0, {});在iOS上如下所示:
window.imageResizer.resizeImage(success, failure, imageURI.replace('file://',''), 300, 0, {});这个答案可能太晚了,不能帮助你,但希望它能帮助其他遇到这个问题的人。
https://stackoverflow.com/questions/17331888
复制相似问题