我正在使用iOS-Cordova跨平台。 我正在从github访问Camera API com.mbppower.camerapreview。 我想放大并缩小我的相机并希望通过原生iOS类捕获图像,我的代码适用于iPhone但不适用于iPad。
AnyOne请帮忙? 我的代码是: -
const CGFloat pinchVelocityDeviderFactor = 1.0f;
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if (([pinchRecognizer state] == UIGestureRecognizerStateBegan) ||
([pinchRecognizer state] == UIGestureRecognizerStateChanged)) {
//Error Message.
NSError *error = nil;
static CGFloat vf;//MAX(1.0, MIN(desiredZoomFactor, self.videoDevice.videoZoomFactor));
if((1.0 <= pinchRecognizer.scale) && (2.5 >= pinchRecognizer.scale))
{
//Setting vf.
vf = 1.0 + pinchRecognizer.scale * pinchVelocityDeviderFactor;
//Get Return Value of lock configuraton.
BOOL bRet = [device lockForConfiguration:&error];
//Lock Configuration.
if(bRet)
{
//if(1.0 <= vf && vf <= 2.5)
//Set Zoom factor.
device.videoZoomFactor = vf;
//Unlock Device Configuration.
[device unlockForConfiguration];
}
}
}
我的应用程序成为iPad的崩溃。
&#39; NSRangeException&#39;,原因:&#39; *** - [AVCaptureVideoDevice setVideoZoomFactor:] - 传递的videoZoomFactor 1.141650超出范围[1,activeFormat.videoMaxZoomFactor]&#39;
请帮助伙计们 谢谢