2

I'm doing an app that does photo uploading to a service. I can take a picture, get it from the library upload it then and so on. Works like a charm. My only issue is that if I get a picture from the library I can get the geo location of that image with the [ALAssetsLibrary assetForURL:url resultBlock:resultblock failureBlock:failureblock] method. If I take an image directly with the UIImagePickerController with the source type camera the image does not have any location data. How can I get location data into that image (and I would prefer to have it in the exif data of the image as well)?

Bests, Philip

plaetzchen
  • 757
  • 6
  • 22
  • This is a pretty common question in SO, e.g. http://stackoverflow.com/questions/1238838/uiimagepickercontroller-and-extracting-exif-data-from-existing-photos/1967111#1967111 (see the very up-voted, not marked correct answer) – danh May 28 '14 at 14:34
  • OK this is also for an image taken with the camera but its by far the worst solution ever and years old. Isn't there a better way? – plaetzchen May 28 '14 at 14:44
  • Look at this one (see the Caleb answer, see the Chris Markle answer which contradicts). There are dozens of articles...http://stackoverflow.com/questions/10302250/reading-the-gps-data-from-the-image-returned-by-the-camera-in-ios-iphone – danh May 28 '14 at 14:50
  • OK, I got that I need to have my own CLLocationManager. But is there a way to write that info to the EXIF data without this old exif library? – plaetzchen May 28 '14 at 14:59
  • Are you using AVCaptureStillImageOutput captureStillImageAsynchronouslyFromConnection:completionHandler: ? As far as I know it should contain the metadata if you authorized the app for location usage through other means. – monkeydom May 31 '14 at 08:37

1 Answers1

0

To finish this up:

I use a CLLocationManager to get my current location and then inject it to my nsdata that I sent using the code that can be found here:

https://stackoverflow.com/a/5294574/516627

Bests, Philip

Community
  • 1
  • 1
plaetzchen
  • 757
  • 6
  • 22