从iPhone相机捕获图像或从库中获取图像,如何获取图像捕获时间?

时间:2013-11-07 13:58:37

标签: ios iphone image time camera

我正在开发iphone应用程序,对图像w.r.t图像捕获时间进行排序。

如何获取图像捕获时间?

感谢。

1 个答案:

答案 0 :(得分:2)

- (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);
}

结果: 日期:2013:11:07 15:19:45