2011-12-09 23 views

回答

9

那么它说,在文档中:

此方法抛出NSInvalidArgumentException如果jpegSampleBuffer是JPEG格式NULL与否。

因此,这可能意味着JPEG处理器预期的数据不在缓冲区中(如果您拍照太快)。

因此,要么你检查imageSampleBufferNULL或我做了什么:我把整个事件封装在if语句中检查:CMSampleBufferIsValid(imageSampleBuffer),但不知道这是否是保护这一点的正确方法。文档有点稀疏。

+0

这有什么更新? – MobileMon

4

像往常一样,检查错误。

[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection 
                completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error) 
{ 
    if (!error) { 

而且只是柜面,这里是(IBAction)didTakePhoto

if (self.captureSession.isRunning) { 
    [self captureNow]; 
     //Custom capture method. 
} 
相关问题