1
A
回答
6
导入imageIO框架并尝试使用带有时间戳的图像。这里是one,将它添加到您的项目中。
#import <ImageIO/ImageIO.h>
NSString *path = [[NSBundle mainBundle] pathForResource:@"gg_gps" ofType:@"jpg"];
NSURL *imageFileURL = [NSURL fileURLWithPath:path];
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)CFBridgingRetain(imageFileURL), NULL);
// or you can get your imageSource this other way:
// NSData *data = [NSData dataWithContentsOfFile:path];
// CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], (NSString *)kCGImageSourceShouldCache, nil];
CFDictionaryRef imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, (CFDictionaryRef)CFBridgingRetain(options));
CFDictionaryRef exifDic = CFDictionaryGetValue(imageProperties, kCGImagePropertyExifDictionary);
if (exifDic){
NSString *timestamp = (NSString *)CFBridgingRelease(CFDictionaryGetValue(exifDic, kCGImagePropertyExifDateTimeOriginal));
if (timestamp){
NSLog(@"timestamp: %@", timestamp);
} else {
NSLog(@"timestamp not found in the exif dic %@", exifDic);
}
} else {
NSLog(@"exifDic nil for imageProperties %@",imageProperties);
}
CFRelease(imageProperties);
相关问题
- 1. 从时间戳获取本地时间
- 2. 从服务器获取的时间戳本地时间戳
- 3. 如何从postgres获取时间戳作为时间戳?
- 4. v4l2图像捕获的时间戳
- 5. 获取从时间戳偏秒差
- 6. 如何从numpy.datetime64获取unix时间戳
- 7. 如何从网页获取时间戳
- 8. 从时间戳获取日期
- 9. 如何从Oracle获取EST时间戳?
- 10. 从网页获取时间戳?
- 11. 从Cassandra获取最后的时间戳
- 12. 获取未来时间戳
- 13. Cumulocity API获取时间戳
- 14. 从Matlab中的时钟图像获取时间 - 图像处理
- 15. 基于从两个不同线程获取的时间戳匹配图像
- 16. 从iPhone上的图像获取地理数据和时间戳sdk
- 17. 从SD卡文件获取时间戳(日期和时间)
- 18. 从时间戳分开获取时间和日期
- 19. 缩小图像时保留时间戳
- 20. 获取时间戳的时区
- 21. C#获取带时区的时间戳
- 22. 从时间戳
- 23. 从时间戳记提取SQL小时
- 24. 如何从时间戳间隔中获取天数列表
- 25. PHP:从阵列获取的时间戳数据之间
- 26. C#:在图像上绘制时间戳
- 27. Rails在CSS中的图像时间戳
- 28. 如何从本地时间戳获取UTC时代值
- 29. 使用JavaScript获取唯一时间戳
- 30. Mysql select - 获取时间戳的日期
由于我已经有图像作为一个对象,我只用了注释掉的部分代码的最后两行。 然而,Xcode中给我一个错误的地方告诉我(CFDataRef)切换到(__bridge CFDataRef),当我这样做,我得到了一个rumtime错误说: 为i386硬件架构未定义的符号: *大多数功能从代码*。 ld:未找到架构的符号i386 clang:错误:链接器命令失败,退出代码1(使用-v查看调用)。 这是什么意思? – Tom 2012-08-07 20:16:14
您需要将ImageIO框架添加到您的目标。 http://stackoverflow.com/questions/3352664/how-to-add-existing-frameworks-in-xcode-4 – 2012-08-07 22:20:47
对不起,我一直很慢...但我得到:“在时间戳中找不到时间戳”在我所有的iphone照片上。这是否意味着iphone有一个标准,在拍照时不会创建时间戳? – Tom 2012-08-10 13:13:13