title: Getting Exposure Time (EXIF) from CMSampleBuffer
body: <p>I am trying to get the exposure time from an image captured using <code>AVFoundation</code>. When I followed the 2010's WWDC instruction about retrieving useful image metadata from <code>CMSampleBuffer</code> like this:</p>
  
  <pre><code>-(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];
  }
  </code></pre>
  
  <p>I had an error on the <code>CFDictionaryRef</code> line: </p>
  
  <pre class="lang-none prettyprint-override"><code>Cannot initialize a variable of type'CFDictionaryRef (aka 'const __CFDictionary*') with an rvalue of type CFTypeRef..
  </code></pre>
  
  <p>So I followed a solution in the internet by casting it like this:</p>
  
  <pre><code>CFDictionaryRef exifAttachments = (CFDictionaryRef)CMGetAttachment(buf, kCGImagePropertyExifDictionary, NULL);
  </code></pre>
  
  <p>And now it gives me another error: Undefined symbols for architecture armv7s </p>
  
  <pre class="lang-none prettyprint-override"><code>(Apple Mach-o Linker Error: "_kCGImagePropertyExifDictionary", referenced from:)
  (Apple Mach-o Linker Error: "_CMGetAttachment", referenced from:)
  </code></pre>
  
  <p>I don't understand what went wrong with my program. Anybody has any idea?</p>