iphone - 获取 CGImageSourceRef 的图像路径

标签 iphone objective-c xcode exif

嘿伙计们,我目前正在尝试从用户通过 UIIMagePickerController 选择的图像中获取 EXIF 数据。 。我似乎无法弄清楚如何获得可用于 CGImageSourceCreateWithURL((CFURLRef)someURL,nil) 的路径.

当我尝试使用UIImagePickerControllerReferenceURL时控制台输出一个相当不错的错误:<ERROR> CGImageSourceCreateWithURLCFURLCreateDataAndPropertiesFromResource failed with error code -11. 。我很困惑,我开始认为我来自一个完全错误的角度,因为 CGImageSourceRef type 通常用于创建图像,而我已经有一个 UIImage 。任何人都可以对此事有所了解,请随意这样做。

- (void)imagePickerController:(UIImagePickerController*)pickerdidFinishPickingMediaWithInfo:(NSDictionary *)info {

<pre><code>NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType]; [self dismissModalViewControllerAnimated:YES]; if ([mediaType isEqualToString:(NSString *)kUTTypeImage]){ image = [info objectForKey:UIImagePickerControllerOriginalImage]; NSLog(@"%@",[info objectForKey:UIImagePickerControllerReferenceURL]); //Outputs: assets-library://asset/asset.JPG?id=1000000006&ext=JPG CGImageSourceCreateWithURL((CFURLRef)[info objectForKey:UIImagePickerControllerReferenceURL], nil); //The plan is to somehow get a CGImageSourceRef object from the //UIImage provided by the [info UIImagePickerControllerOriginalImage], i just don't know how to get this object, // for it requires the URL to the image, wich i don't seem to have. } } </code></pre>

-编辑- 将使用更紧张提供的解决方法。感谢您的阅读。

最佳答案

错误代码-11表示URL方案无法识别,也就是说CFURL不知道如何处理以assets-library://开头的URL。

为什么你认为在这种情况下需要 CGImageSourceRef?

关于iphone - 获取 CGImageSourceRef 的图像路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6044528/

相关文章:

ios - 核心蓝牙框架和兼容设备

ios - 如何在单击删除按钮时更改表行颜色,而不是在 iOS 中删除行

iphone - 消息与电子邮件

iphone - iPhone App Store 应用程序允许使用内部脚本/编程语言吗?

c - GNU GSL BLAS 库, undefined symbol

iphone - 从 contentViewController 中消除 UIPopOverController

javascript - 从 TCP 流中解析出数据段

ios - 如何限制用户在 objective-c 中顺序选择单元格

objective-c - 如何检查您的 iOS 应用代码是否使用了应用商店不允许的 API?

iphone - sqlite_step(语句)中的 EXC_BAD_ACCESS