I'm struggling to figure out how I can obtain an image from a UIImagePickerControllerReferenceURL (I know that I can obtain it directly from UIImagePickerControllerOriginalImage however, I have reasons for wanting not to). Here's what I have
/*
* Responds when an image is selected (from browsing)
*/
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [self obtainImageAtURLPath:[info objectForKey:UIImagePickerControllerReferenceURL]];
if(!image) return;
//...more code here
}
- (UIImage *) obtainImageAtURLPath:(NSURL *) urlPath
{
UIImage *image = [UIImage imageWithContentsOfFile:[urlPath path]];
return image;
}
However, when I do this, I always get nil instead of my image. The urlPath exists; however, it doesn't want to be converted to a UIImage. Help please.
If I print out NSLog(@"%@", urlPath) I get assets-library://asset/asset.JPG?id=53784678-BD17-4EE4-9A96-601B81012AFE&ext=JPG
If I print out NSLog(@"%@", [urlPath path]) I get /asset.JPG.
AssetsLibraryframework agilewarrior.wordpress.com/2012/02/06/… - Dustin