Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ios imageResizer NSInvalidArgumentException_Ios_Cordova - Fatal编程技术网

ios imageResizer NSInvalidArgumentException

ios imageResizer NSInvalidArgumentException,ios,cordova,Ios,Cordova,当图像带有IMG_数据时,我在调整图像大小时遇到了问题。数据没有给出错误,但是当它给出这个异常IMG_URI时 调用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

当图像带有IMG_数据时,我在调整图像大小时遇到了问题。数据没有给出错误,但是当它给出这个异常IMG_URI时

调用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'
                                    }
        );

我在当前的一个项目中遇到了一个类似的问题,我设法解决了这个问题。问题只发生在iOS设备上,特别是iPad,而不是我的Galaxy S3或Android emulator。因此,经过数小时的调试,我注意到media capture插件工作正常,但摄像头插件没有工作。在比较这两个插件时,我注意到摄像头插件返回了一个以“file://”开头的URI,而media capture插件给出了一个类似“/var/…”的文件路径。在传递到resizeImage之前,我从路径中删除了“file://”,一切正常

总之,更改此项:

window.imageResizer.resizeImage(success, failure, imageURI, 300, 0, {});
要在iOS上执行此操作,请执行以下操作:

window.imageResizer.resizeImage(success, failure, imageURI.replace('file://',''), 300, 0, {});

这个答案可能太晚了,无法帮助您,但希望它能帮助遇到这个问题的其他人。

谢谢!这是一种祝福,我的几个小时被你大大缩短了。谢谢谢谢谢谢!!