Вопрос

This is my code:

-(void) captureOutput:(AVCaptureOutput*)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection*)connection
{
    CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer( sampleBuffer );
    CGSize imageSize = CVImageBufferGetEncodedSize( imageBuffer );
    // also in the 'mediaSpecific' dict of the sampleBuffer

    NSLog( @"frame captured at %.fx%.f", imageSize.width, imageSize.height );
}

(It is not really relevant for the question, but this a function of AVCaptureVideoDataOutputSampleBufferDelegate)

Anyway, the problem is that CMSampleBufferGetImageBuffer CVImageBufferGetEncodedSize are not recognised. I got the error:

Undefined symbols for architecture i386:
  "_CMSampleBufferGetImageBuffer", referenced from:

It is a standard error:Undefined symbols for architecture armv7 But the solutions not working for me: - I added the framework to Link Binary With Libraries correctly. - I imported <CoreMedia/CMSampleBuffer.h>, which contains this classes in the .h.

So what is the problem???

Это было полезно?

Решение

You need to add the CoreMedia.framework. Go to your target -> Build Phases -> Link Binary With Libraries and add it.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top