这是我的代码:
-(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:
这是一个标准错误:架构 armv7 的未定义符号
但解决方案对我不起作用: - 我将框架添加到 Link Binary With Libraries 正确。- 我导入<CoreMedia/CMSampleBuffer.h>
了 .h 中包含这些类。
那么问题出在哪里???