Developer
Developer

Reputation: 107

capture image from iphone camera or get it from library, How to get the image capture time?

I am working on iphone application, sort the images w.r.t image capture time.

How to get the image capture time?

Thanks.

Upvotes: 0

Views: 177

Answers (1)

TUNER88
TUNER88

Reputation: 923

- (void) imagePickerController: (UIImagePickerController *) picker
 didFinishPickingMediaWithInfo: (NSDictionary *) info {
    NSDictionary *metadata = [[NSDictionary alloc] initWithDictionary:[info objectForKey:UIImagePickerControllerMediaMetadata]];
    NSDictionary *exifData = [[NSDictionary alloc] initWithDictionary:[metadata objectForKey:@"{Exif}"]];
    NSString *captureDate = [exifData objectForKey:@"DateTimeOriginal"];

    NSLog(@"Date: %@", captureDate);
}

Result: Date: 2013:11:07 15:19:45

Upvotes: 2

Related Questions