title: Reading the GPS data from the image returned by the camera in iOS iphone
body: <p>I need to get the GPS coordinates of an image taken with the iOS device's camera. I do not care about the Camera Roll images, just the image taken with UIImagePickerControllerSourceTypeCamera.</p>
  
  <p>I've read many stackoverflow answers, like <a href="https://stackoverflow.com/questions/9766394/get-exif-data-from-uiimage-uiimagepickercontroller">Get Exif data from UIImage - UIImagePickerController</a>, which either assumes you are using the AssetsLibrary framework, which doesn't seem to work on camera images, or use CoreLocaiton to get the latitude/longitude from the app itself, not from the image.</p>
  
  <p>Using CoreLocation <em>is not an option</em>. That will not give me the coordinates when the shutter button was pressed. (With the CoreLocation based solutions, you either need to record the coords before you bring up the camera view or after, and of course if the device is moving the coordinates will be wrong. This method should work with a stationary device.) </p>
  
  <p>I am iOS5 only, so I don't need to support older devices. This is also for a commercial product so I cannot use <a href="http://code.google.com/p/iphone-exif/" rel="noreferrer">http://code.google.com/p/iphone-exif/</a>.</p>
  
  <p>So, what are my options for reading the GPS data from the image returned by the camera in iOS5? All I can think of right now is to save the image to Camera Roll and then use the AssetsLibrary, but that seems hokey.</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>Here's the code I wrote based on Caleb's answer. </p>
  
  <pre><code>    UIImage *image =  [info objectForKey:UIImagePickerControllerOriginalImage];
  
      NSData *jpeg = UIImageJPEGRepresentation(image,1.0);
      CGImageSourceRef  source ;
      source = CGImageSourceCreateWithData((__bridge CFDataRef)jpeg, NULL);
  
      NSDictionary *metadataNew = (__bridge NSDictionary *) CGImageSourceCopyPropertiesAtIndex(source,0,NULL);  
  
      NSLog(@"%@",metadataNew);
  </code></pre>
  
  <p>and my Console shows:</p>
  
  <pre><code>    2012-04-26 14:15:37:137 ferret[2060:1799] {
          ColorModel = RGB;
          Depth = 8;
          Orientation = 6;
          PixelHeight = 1936;
          PixelWidth = 2592;
          "{Exif}" =     {
              ColorSpace = 1;
              PixelXDimension = 2592;
              PixelYDimension = 1936;
          };
          "{JFIF}" =     {
              DensityUnit = 0;
              JFIFVersion =         (
                  1,
                  1
              );
              XDensity = 1;
              YDensity = 1;
          };
          "{TIFF}" =     {
              Orientation = 6;
          };
      }
  </code></pre>
  
  <p>No latitude/longitude.</p>