ALAsset 时间戳返回错误日期
我试图获取图像的时间戳,我可以获得正确的纬度和经度值,但时间戳始终返回当前时间,而不是图像的 EXIF 时间。
ALAssetsLibraryAssetForURLResultBlock resultsBlock = ^(ALAsset *asset) {
CLLocation *imageLoc = [asset valueForProperty:ALAssetPropertyLocation];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd/MM/YY HH:mm:ss"];
NSString *trailTime = [formatter stringFromDate:imageLoc.timestamp];
NSLog(@"---+++ image TimeStamp: %@", trailTime);
[formatter release];
任何帮助表示赞赏,谢谢
I am trying to get the timestamp of images, I can get the correct latitude and longitude values, but the timestamp always returns the current time, not the EXIF time of the image.
ALAssetsLibraryAssetForURLResultBlock resultsBlock = ^(ALAsset *asset) {
CLLocation *imageLoc = [asset valueForProperty:ALAssetPropertyLocation];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd/MM/YY HH:mm:ss"];
NSString *trailTime = [formatter stringFromDate:imageLoc.timestamp];
NSLog(@"---+++ image TimeStamp: %@", trailTime);
[formatter release];
Any help appreciated, thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要使用
ALAssetPropertyDate
键。You will need to get the date using
ALAssetPropertyDate
key.好的,我找到了答案
给我字典格式的整个元数据的是:
//希望这对其他人有帮助。
OK I found the answer
What gave me the entire metadata in dictionary format was:
//Hope this helps others.
您似乎正在获取位置来获取日期。你应该做类似以下的事情:
It seems like you're fetching location to get the date. you should be doing something like the following: