如何从iOS照片(如相机胶卷)获取图像创建日期时间或上次修改日期时间? [英] How can I get image created date time or last modified date time from iOS Photos (like camera roll)?

查看:969
本文介绍了如何从iOS照片(如相机胶卷)获取图像创建日期时间或上次修改日期时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS的新手。最近,我正在开发一个iOS应用程序,需要检查图像(在iOS 照片中)创建的日期时间和修改日期时间,以便按时间对这些图像进行排序。
我使用 ALAssetsLibrary 来枚举所有图像,我可以获得每个图像的以下属性:图像文件名,图像资产网址(在其中,我可以获得图像文件扩展名和唯一资产ID) 。但有人可以告诉我如何获取图像文件创建日期时间和上次修改日期时间吗?



非常感谢。

  ALAsset *资产; 
...
NSDate * date = [asset valueForProperty:ALAssetPropertyDate];

我不确定检索上次修改日期的方法。


I am a new guy to iOS. Recently, I am developing an iOS application need to check image (in iOS Photos) created date time and modified date time to sort these images by time. I used ALAssetsLibrary to enumerate all images, i can get following attributes of each image: image file name, image asset url (within it, i can get image file extension and unique asset id). But could someone tell me how to get the image file created date time and last modified date time?

Thanks very much.

解决方案

You can retrieve the creation date of the asset using the ALAssetPropertyDate property:

ALAsset* asset;
...
NSDate* date = [asset valueForProperty:ALAssetPropertyDate];

I'm not sure of a method to retrieve the last modified date.

这篇关于如何从iOS照片(如相机胶卷)获取图像创建日期时间或上次修改日期时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆