简体   繁体   中英

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 wrt image capture time.

How to get the image capture time?

Thanks.

- (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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM