5

I am using a regular UIImagePickerController to capture photo using the device camera. Following is the code I am using to create the UIImagePickerController,

self.imagePickerController = [[UIImagePickerController alloc] init];
self.imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.imagePickerController.allowsEditing = NO;
self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
self.imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.imagePickerController.delegate = self;

and following is the code that I am using to display the UIImagePickerController

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

Now, when the UIImagePickerController is presented, if I zoom to capture and come back to my presenting view controller, the app crashes irregularly with BAD_ACCESS. After editing the scheme and some debugging, I see the following error,

-[PLImagePickerCameraView didHideZoomSlider:]: message sent to deallocated instance 0x140109400

It seems that the zoom slider delegate is called on an unallocated instance. Anyone else observed this behaviour? I am using working on iOS 8.1 and testing it on iPhone 5S. The search for PLImagePickerCameraView doesn't yield much. Any insights would be really helpful before I decide to go with custom Picker.

ChintaN -Maddy- Ramani
  • 5,156
  • 1
  • 27
  • 48
Priyank
  • 51
  • 2
  • possible duplicate of [How-to find out what causes a didHideZoomSlider error on IOS 8?](http://stackoverflow.com/questions/26844432/how-to-find-out-what-causes-a-didhidezoomslider-error-on-ios-8) – RyanJM Nov 13 '14 at 17:37
  • 1
    @Priyank - How did you resolve the issue? – tech_human Dec 23 '14 at 18:45
  • Adding delay is the only feasible solution for now it seems. Don't want to develop my custom camera functionality. – Priyank Jan 15 '15 at 11:29

1 Answers1

0

I experienced the UIImagePickerController zoom crash, as well. Adding a delay fixed most, but not all, of the crashes.

The root cause is the controller attempting to callback to a delegate after the delegate has been deallocated. I ended up implementing a subclassed UIImagePickerController to remove the delegate of the slider view.

You can find some sample code I posted on a similar question.

Community
  • 1
  • 1
adamup
  • 1,508
  • 19
  • 29