我正在尝试从使用AVFoundation
. 当我遵循 2010 年的 WWDC 指令时,关于从中检索有用的图像元数据CMSampleBuffer
:
-(void)captureStillImageWithCompletion:(completion_exp)completionHandler
{
AVCaptureConnection *connection = [stillImage connectionWithMediaType:AVMediaTypeVideo];
typedef void(^MyBufBlock)(CMSampleBufferRef, NSError*);
MyBufBlock h = ^(CMSampleBufferRef buf, NSError *err){
CFDictionaryRef exifAttachments = CMGetAttachment(buf, kCGImagePropertyExifDictionary, NULL);
if(exifAttachments){
NSLog(@"%@",exifAttachments);
}
if(completionHandler){
completionHandler();
}
};
[stillImage captureStillImageAsynchronouslyFromConnection:connection completionHandler:h];
}
我在线上有一个错误CFDictionaryRef
:
Cannot initialize a variable of type'CFDictionaryRef (aka 'const __CFDictionary*') with an rvalue of type CFTypeRef..
所以我在互联网上遵循了一个解决方案,如下所示:
CFDictionaryRef exifAttachments = (CFDictionaryRef)CMGetAttachment(buf, kCGImagePropertyExifDictionary, NULL);
现在它给了我另一个错误:Undefined symbols for architecture armv7s
(Apple Mach-o Linker Error: "_kCGImagePropertyExifDictionary", referenced from:)
(Apple Mach-o Linker Error: "_CMGetAttachment", referenced from:)
我不明白我的程序出了什么问题。有人有什么想法吗?