0

enter image description here This is an issue reported at crashlytics. I am getting this(I assume) when I load image picker and dismiss. I only got this once. But it got something to do with image picker or navigation controller. Does any one know the cause?

Update Image picker camera is loaded like this.

    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;
    imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePickerController.delegate = self;
    if([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft)
    {
        [[UIDevice currentDevice]setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeRight] forKey:ORIENTATION_STRING];
    } else {
        [[UIDevice currentDevice]setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:ORIENTATION_STRING];
    }

    self.imagePickerController = imagePickerController;
    [self.navigationController presentViewController:self.imagePickerController animated:YES completion:nil];

for other source types, I am using the following code.

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;
popOver = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
self.imagePickerController = imagePickerController;
popOver.delegate = self;
CGRect popOverRect = sender.frame;
[popOver presentPopoverFromRect:popOverRect
                         inView:self.view
       permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
krishnanunni
  • 510
  • 7
  • 16

1 Answers1

0

Add UIIMagePickerController to ContainerView. & then to view

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *)   kUTTypeMovie, nil];

[self addChildViewController:picker] ;

[picker didMoveToParentViewController:self] ;

[self.view addSubview:picker.view] ;

while removing pickercontroller do

[picker.view removeFromSuperview] ;
[picker removeFromParentViewController] ;
poojathorat
  • 1,200
  • 2
  • 9
  • 19