3

I'm working on an app that involves getting information from a photo that is taken with the in-built camera of the iPhone.

UIImagePickerController * picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;

picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];

I would like to get the info on date/time of capture as well as the coordinates of the place of capture. Any idea how I would do this?

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
  • 1
    It is called EXIF data, here is a related post. http://stackoverflow.com/questions/3673062/how-to-access-photo-exif-in-pictures-taken-from-camera-in-ios-4-0 – Joe Apr 21 '11 at 13:02

1 Answers1

0

Using the Asset framework you can do this:

  #import <AssetsLibrary/AssetsLibrary.h>

  ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
  NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL];

  [library assetForURL:url resultBlock:^(ALAsset *asset) {
    NSLog(@"TIMESTAMP: %@", [asset valueForProperty:ALAssetPropertyDate]);
  } failureBlock:^(NSError *error) {
      NSLog(@"FAIL");
  }];
ZaBlanc
  • 4,679
  • 1
  • 35
  • 38