我使用avfoundation捕獲圖像,但我無法快速捕獲(我將間隔時間設置爲0.1s)。它說「NULL樣本緩衝區」。問題是什麼?謝謝。使用avfoundation捕獲圖像,但不能捕獲得太快
[stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error)
{
CFDictionaryRef exifAttachments = CMGetAttachment(imageSampleBuffer, kCGImagePropertyExifDictionary, NULL);
if (exifAttachments)
{
// Do something with the attachments.
// NSLog(@"attachements: %@", exifAttachments);
}
else
NSLog(@"no attachments");
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
UIImage *image = [[UIImage alloc] initWithData:imageData];
//use the image
}];
*終止應用程序由於未捕獲的異常 'NSInvalidArgumentException',原因: '* + [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:] - NULL樣品緩衝液'。
面臨同樣的問題,你能解決這個問題嗎? – BaSha