获取CGImageSourceRef的图像路径

Uxx*_*ish 2 iphone xcode exif objective-c

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

当我尝试使用UIImagePickerControllerReferenceURL控制台时吐出一个相当不错的错误:<ERROR> CGImageSourceCreateWithURLCFURLCreateDataAndPropertiesFromResource failed with error code -11..我很难过,我开始认为我来自一个完全错误的角度,因为这种CGImageSourceRef类型通常用于创建图像,而我已经有了UIImage.任何能够解释这个问题的人,请随时这样做.

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

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.
    }

}
Run Code Online (Sandbox Code Playgroud)

UIIMagePickerController

-Edit-将使用更紧张的解决方案.谢谢阅读.

mor*_*ion 5

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

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