2

How do i get a date or metadata from a UIImage in this case:

//UIImagePickerControllerSourceType
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

//delegate return
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

// po info in console -> there is no metadata of the image where i can find the date
// Has anyone an idea how to get it?

}
Matt
  • 14,353
  • 5
  • 53
  • 65
Bart Schoon
  • 299
  • 5
  • 11

3 Answers3

1

If you are referring to EXIF metadata in the image (which includes date information), you can see this question for information on how to access it:

How to access photo EXIF in pictures taken from camera in iOS 4.0+?

Community
  • 1
  • 1
Greg
  • 33,450
  • 15
  • 93
  • 100
0

The info dictionary contains a key called "UIImagePickerControllerMediaMetadata" which is another dictionary. Just NSLog allKeys of that to get the date key.

Keller
  • 17,051
  • 8
  • 55
  • 72
0
NSDictionary *metadata = [info objectForKey: UIImagePickerControllerMediaMetadata];
NSLog(@"%@",metadata);

Choose what you need from metadata.

Dunja Lalic
  • 752
  • 13
  • 26
  • Oke thanks, i have notice that it is in the info dict when the sourceType is set to Camera. But when it is set to Library this is the content of the dict: `code Current language: auto; currently objective-c (gdb) po info { UIImagePickerControllerMediaType = "public.image"; UIImagePickerControllerOriginalImage = ""; UIImagePickerControllerReferenceURL = "assets-library://asset/asset.JPG?id=1000000115&ext=JPG"; }` – Bart Schoon Mar 11 '11 at 21:41
  • UIImagePickerControllerMediaMetadata - This key is valid only when using an image picker whose source type is set to UIImagePickerControllerSourceTypeCamera, and applies only to still images. - is (unfortunately) what Apple documentation says. I think the answer then is in @GregInYEG post. – Dunja Lalic Mar 11 '11 at 22:24