ALAssetPropertyDate返回“错误”日期 [英] ALAssetPropertyDate returns "wrong" date
问题描述
我正在开展一个项目,我需要阅读一些(纬度,经度和日期)EXIF数据。位置数据似乎正确,但我收到的日期似乎是最后修改日期。
I'm currently working on a project in which i need to read some (Latitude, Longitude and date ) EXIF data. The location data seems correct, but the date i'm getting seems to be the "date last modified" date.
{
CLLocation *loc = [asset valueForProperty:ALAssetPropertyLocation];
NSDate *date = [asset valueForProperty:ALAssetPropertyDate];
//Returns Last modified date(Picture was taken ... let's say september
//last year and it would return the date and time I 'modified' the image).
NSString *latitude = [NSString stringWithFormat:@"%g",loc.coordinate.latitude];//Returns correct Latitude
NSString *longitude = [NSString stringWithFormat:@"%g",loc.coordinate.longitude];//Returns correct Longitude
}
我的问题是:我是做一些非常错误的事情,或者是这个预期的行为。
我也尝试使用 loc.timestamp
而不是 [asset valueForProperty:ALAssetPropertyDate]
但这些返回同一天。
非常感谢任何帮助!
My question is: Am i doing something terribly wrong, or is this expected behavior.
I also tried to use the loc.timestamp
instead of the [asset valueForProperty:ALAssetPropertyDate]
but these returned the same date.
Any help is greatly appreciated !
推荐答案
虽然没有明确记录,我猜这是预期的行为。日期是指创建资源,当您修改图像时,您可能会隐式创建新资产。 ALAsset
文档中的任何内容都不表示其属性对应于图像的EXIF数据。
Though it's not explicitly documented, I'm guessing that this is the expected behavior. The date refers to when the asset was created and when you're modifying the image, you're probably implicitly creating a new asset. Nothing in the ALAsset
documentation suggests that its properties correspond to the image's EXIF data.
要访问EXIF数据,您可以使用Image I / O框架(可从iOS 4.0开始使用),特别是 CGImageSourceCopyProperties
函数。
To access the EXIF data, you could use the Image I/O framework (available since iOS 4.0), specifically the CGImageSourceCopyProperties
function.
这篇关于ALAssetPropertyDate返回“错误”日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!