嘿伙计们,我目前正在尝试从用户通过 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/