문제

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