I have a straightforward implementation of capturing a picture with a preview using AVFoundation: https://gist.github.com/1933313
Everything works perfectly except that my picture resolution is 304×400.
My problems is that as soon as I try to change the default sessionPreset (line 16 & 17) to something as small as AVCaptureSessionPreset640x480 it stopes working: it reaches line 60 and the call to [self.stillImageOutput captureStillImageAsynchronouslyFromConnection] will throw the exception
'NSInvalidArgumentException', reason: '*** -[AVCaptureStillImageOutput captureStillImageAsynchronouslyFromConnection:completionHandler:] - inactive/invalid connection passed.'
because - (AVCaptureConnection*)getConnection will return nil (line 61)
Anyone has any idea why this is happening ?
PS: The device on which I test is an iPhone 3G running iOS 4.2.1
I found the answer in their twisted doc :). Here is the answer: the iPhone 3G does not support 640×480 resolution. Now, why it supports 400×304 & 1600×1200 but no other resolutions in between, it eludes me …