Normally this happens when some memory problems occurred. Like low memory or some times the init of UICameraPickerController
is been released by some wrong call to it.
The best way to reduce or avoid this is to when ever you try to access it at the time alloc and init it and when ever you try to move from camera view just dealloc it.
Even when app goes to background ie minimised dealloc the UICameraPicker and on entering in foreground ie maximised it again realloc it.
Basically what I do is, I take one property declared in .h file as follow:
@property (nonatomic, strong) UIImagePickerController *imagePicker;
Then in .m file synthesise it, when required, for me on the tap of "Take Picture" button. I use following coed to show image picker controller.
if(self.imagePicker == nil || self.imagePicker == NULL)
imagePicker = [[UIImagePickerController alloc]init];
<Then put the code for use of picker.>
And then on getting the image in picker's delegate method, imagePickerController:didFinishPickingMediaWithInfo
after storing image in proper property or iVar use the following code to release the imagePicker's instance.
self.imagePicker = nil;
This will solve the problem for me. May this will also help you to solve yours one, too.