IOS 8 UIImagePickerController scaling failed

I use the usual UIImagePickerController to capture photos using the device’s camera. Below is the code I use 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 the following code that I use to display the UIImagePickerController

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

Now that the UIImagePickerController is presented, if I zoom in on the capture and return to my view controller, the application will crash with BAD_ACCESS. After editing the circuit and some debugging, I see the following error:

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

It seems that the scale slider delegate is being called on an unallocated instance. Has anyone else observed this behavior? I use work on iOS 8.1 and test it on iPhone 5S. Searching for PLImagePickerCameraView doesn't give much. Any information would be really helpful before I decided to go with a custom Picker.

+5
source share
1 answer

I experienced a failure while scaling UIImagePickerController . Adding a delay fixed most, but not all, crashes.

The main reason is the controller attempting to call a delegate after releasing the delegate. I completed the implementation of the UIImagePickerController subclass to remove the delegate from the slider view.

You can find the sample code that I posted in a similar question .

0
source

Source: https://habr.com/ru/post/1206564/


All Articles