3

When I am using UIImagePickerController in IOS7.0.3 it seems to throw an error "Snapshotting a view that has not been rendered results in an empty snapshot". My code is shown below

-(void) showCamera
{
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {
        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.delegate = self;
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.showsCameraControls = YES;

        [self presentViewController:imagePicker animated:YES completion:nil];
    }
}

Delegate method is

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{

    [self dismissViewControllerAnimated:YES
                             completion:nil];

    NSString *mediaType = info[UIImagePickerControllerMediaType];

       UIImage *image = nil;
    if ([mediaType isEqualToString:(__bridge NSString *)kUTTypeImage])
    {

        image = info [
                       UIImagePickerControllerOriginalImage];

    }


    if(picletImage != nil)
    {
        self.imageView.image = image;

    }

}

I dont know whats wrong here but this seems to be working fine on iPad. I read through good number of articles but did not get a solution for this . I verified in instruments and seems to be a memory leak happening during camera initialization or once the picture is captured. I have been stuck with this for past 4 days , can some one can help me out as what is going wrong and also a possible solution for this.

Tim
  • 59,527
  • 19
  • 156
  • 165
  • 2
    Hi , did any one found a solution for this. Appreciate if they can share the solution. – user1673825 Nov 04 '13 at 05:36
  • There's another [post](http://stackoverflow.com/questions/18890003/uiimagepickercontroller-error-snapshotting-a-view-that-has-not-been-rendered-re) that discusses the same problem, and the solution given there is just to make sure no transitions are happening when you display the image picker. – Chris Loer Feb 04 '14 at 17:44

0 Answers0