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. 从PHP获取时间戳
- 2. 从时间戳获取本地时间
- 3. 从服务器获取的时间戳本地时间戳
- 4. 从特定时间戳获取午夜时间戳值
- 5. 如何从postgres获取时间戳作为时间戳?
- 6. v4l2图像捕获的时间戳
- 7. 使用ALAssetLibrary获取图片库中图像的时间戳
- 8. 获取从时间戳偏秒差
- 9. 获取从谷歌文档时间戳
- 10. 从Cassandra获取最后的时间戳
- 11. 如何从网页获取时间戳
- 12. PHP - 从时间戳中获取milliSecond
- 13. 从网页获取时间戳?
- 14. 从时间戳获取日期
- 15. 如何从numpy.datetime64获取unix时间戳
- 16. 从时间戳获取日期
- 17. 从时间戳获取tzinfo对象
- 18. 如何从Oracle获取EST时间戳?
- 19. 获取时间戳rtp包
- 20. 获取unix时间戳
- 21. 获取未来时间戳
- 22. iOS获取UTC时间戳
- 23. 从Matlab中的时钟图像获取时间 - 图像处理
- 24. PHP如何从时间戳获得日/时间的时间戳
- 25. 使用ffmpeg从视频中提取多个图像并获取提取图像的时间戳
- 26. 基于从两个不同线程获取的时间戳匹配图像
- 27. 从iPhone上的图像获取地理数据和时间戳sdk
- 28. 从多个表中获取最大时间戳到视图中
- 29. 从连接日期和时间列获取时间戳
- 30. 无法获取从PHP中的时间戳日期和时间?
由于我已经有图像作为一个对象,我只用了注释掉的部分代码的最后两行。 然而,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