Instead of embedding four or five functions on one line, you need to do more error handling in your code.
Consider this instead:
NSURL * referenceURL = [info objectForKey: UIImagePickerControllerReferenceURL];
if(referenceURL == NULL)
{
NSLog( @"reference URL is null");
} else {
NSData * imageData = [NSData dataWithContentsOfURL: referenceURL];
if(imageData == NULL)
{
NSLog( @"no image data found for URL %@", [referenceURL absoluteString] );
} else {
UIImage * theActualImage = [UIImage imageWithData: imageData];
if(theActualImage == NULL)
{
NSLog( @"the data at URL %@ is not an image", [referenceURL absoluteString] );
} else {
if(theImageView == NULL)
{
NSLog( @"I forgot to set theImageView" );
} else {
theImageView.image = theActualImage;
}
}
}
}
I hope this info helps you out.