title: Get Geolocation for image captured using AVFoundation's AVCaptureStillImageOutput
body: <p>I used AVFoundation to capture an image in a UIView and add comments to it. Now, I need to get the geolocation of the captured image. My current code snippet is as shown below. The metadata does not have the geolocation. Maybe I will have to use CLLocation? Please guide me ASAP.</p>
  
  <pre><code>[stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error)
   {
       CFDictionaryRef metadataDict = CMCopyDictionaryOfAttachments(NULL, imageSampleBuffer, kCMAttachmentMode_ShouldPropagate);
       NSMutableDictionary *metadata = [[NSMutableDictionary alloc] initWithDictionary:(__bridge NSDictionary*)metadataDict];
       CFRelease(metadataDict);
       NSLog(@"%@",metadata);
       CFDictionaryRef exifAttachments = CMGetAttachment( imageSampleBuffer, kCGImagePropertyExifDictionary, NULL);
       if (exifAttachments)
       {
           // Do something with the attachments.
       }
       else
           NSLog(@"no attachments");
  
       NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
       [captureSession stopRunning];
       [imageData writeToFile:path atomically:YES];
   }];
  </code></pre>