CMSampleBufferGetImageBuffer CVImageBufferGetEncodedSize产生问题

时间:2013-09-19 15:13:42

标签: objective-c linker-errors core-media

这是我的代码:

-(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 );
}

(这与问题无关,但这是AVCaptureVideoDataOutputSampleBufferDelegate

的功能

无论如何,问题是无法识别CMSampleBufferGetImageBuffer CVImageBufferGetEncodedSize。我收到了错误:

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

这是一个标准错误:Undefined symbols for architecture armv7 但解决方案不适合我: - 我正确地将框架添加到Link Binary With Libraries。 - 我导入了<CoreMedia/CMSampleBuffer.h>,其中包含.h。

中的这些类

那么问题是什么?

1 个答案:

答案 0 :(得分:18)

您需要添加CoreMedia.framework。转到目标 - &gt;构建阶段 - &gt;将二进制文件链接到库并添加它。