It made me whole days ...
In my application, I use AVCapture to take a photo, then I use the ZBar SDK to scan the barcode. The problem is that when I load the ZBar after shooting, I lose the ability to autofocus when shooting another image. If I load the ZBar first, then I can adjust the focus when shooting, but the ZBar loses the ability to focus! I tried replacing the ZBar with the ShopSavvy scanner SDK, and I ran into the same problem ...
Here is the code that I use to turn the camera on to auto focus, but the error does not occur, and I cannot focus!
AVCaptureDevice *device = [[self videoInput] device]; if ([device isFocusPointOfInterestSupported] && [device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) { NSError *error; if ([device lockForConfiguration:&error]) { [device setFocusPointOfInterest:point]; [device setFocusMode:AVCaptureFocusModeContinuousAutoFocus]; [device unlockForConfiguration]; } else { if ([[self delegate] respondsToSelector:@selector(captureManager:didFailWithError:)]) { [[self delegate] captureManager:self didFailWithError:error]; } } }
source share