我想從使用AVFoundation
捕獲的圖像獲取曝光時間。當我跟着2010年的約檢索有用的圖像元數據WWDC指令從CMSampleBuffer
這樣的:iOS:從CMSampleBuffer獲取曝光時間(EXIF)
-(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);
而現在它給了我另一個錯誤:未定義的符號體系結構armv7s
(Apple Mach-o Linker Error: "_kCGImagePropertyExifDictionary", referenced from:)
(Apple Mach-o Linker Error: "_CMGetAttachment", referenced from:)
我不明白我的程序出了什麼問題。任何人有任何想法?
添加ImageIO框架爲我工作,謝謝! – jungledev