views:

222

answers:

1

I'm trying to get a basic image picker/photo taker running in my app and have run into the following error:

 *** ERROR: FigCreateCGImageFromJPEG returned -1. Input (null) was 551120 bytes

I have the image picker showing, the camera view works fine.

When I take an image with the camera and select the 'use' button the error appears in the console and the app crashes.

The App works fine just for selecting an image from the album. I have looked at similar threads here and no solution seems to have been proposed.

Just wondering if anyone has come across anything helpful.

-(IBAction)getPhoto:(id)sender{
  if((UIButton *) sender == sharePhoto) {
      imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
  } else {
      imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
  }
  [self presentModalViewController:imagePicker animated:YES];
 }

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
   [picker dismissModalViewControllerAnimated:YES];
   imageView.image = [info objectForKey:@""];
}
A: 

I have managed to stop my application crashing but the error persist.

Instead of assigning the UIImage from the NSDictionary *info straight to my UIImageView I retain it in a UIImage variable then dismiss the ModalViewcontroller.

In the viewwillappear method of the root viewcontroller I then assign the image to my UIImageView.image.

I don't know if the order I was doing things was the root cause. The error still appears in the console however.

androider