How to get a NSDATE from UIImage?

心已入冬 提交于 2019-12-19 04:33:51

问题


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?

}

回答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+?




回答2:


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




回答3:


NSDictionary *metadata = [info objectForKey: UIImagePickerControllerMediaMetadata];
NSLog(@"%@",metadata);

Choose what you need from metadata.



来源:https://stackoverflow.com/questions/5276456/how-to-get-a-nsdate-from-uiimage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!