As the title states the app that I am developing has an issue that is caused only when the app is relaunched after entering the background.
The camera iris or shutter gets stuck in the closed position. The funny thing is you can still take a picture but you cannot see the preview. Once the picture is taken, it is shown correctly in the view.
This issue does not happen when the app is launched if the app is completely closed. I can take pictures, add effects and so on, every time the camera is opened it works correctly.
Here are the exact steps to reproduce the issue:
1) I open the app, everything works fine.
2) The app enters the background either by pressing the home button or incoming call.
3) When the app enters the foreground / reopened and the camera is accessed the shutter screen is shown and remains closed in the stuck position.
4) The only way to fix it is to dismiss the modal view camera controller and press the camera button again.
I have done some research to find an answer and have come up with nothing. There are no memory leaks and I have checked the memory allocations in instruments and there is nothing unusual.
Hopefully someone has a solution, I appreciate the help.
Thank you in advance.
I'm having the exact same issue, but narrowed down a bit - it only happens with iOS 5. With some hints from other people talking about memory, I freed up as much memory as possible before presenting the UIImagePickerController and the problem stopped happening.
I was having the same problem, running in an ARC project.
Press the camera button on my main screen, the imagePickerController would display, cancel the imagePickerController. Press the home button (close) the app. Come back to my app and press the camera button again. In this case the shutter would show and be stuck.
Using memory issues as the main clue - I found out that my overlay view had a strong reference to the imagePickerController. I changed this to a weak reference and the problem went away.
I think that when you have the problem, and try to take a photo with the Apple app, you have the problem there also. Isn't it ? If yes, you may restart the device to solve the problem. And apply dana's tip.
When the app goes into background mode then you should dismiss the camera and represent it when the app regains focus.
I was having the same problem , Following solutions works for me. whenever you are presenting UIImagePickerController modally. init it and release it after the use. Hope it works for you also .
self.imagePickerController = [[UIImagePickerController alloc] init];
self.imagePickerController.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
self.imagePickerController.showsCameraControls = NO;
self.imagePickerController.cameraOverlayView = cameraOverlayView;
} else {
self.imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
[self presentViewController:imagePickerController animated:YES completion:^(void)
{
// If you want to do something extra
}];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With