2

I've got a custom screen that uses the camera interface. Every so often, the screen "freezes" with a closed iris. The only way to get out of this locked state is to exit the app.

What could cause the camera iris to remain in a closed position like this?

user229044
  • 232,980
  • 40
  • 330
  • 338
gonzobrains
  • 7,856
  • 14
  • 81
  • 132
  • 1
    I'm having the same issue, please help! It's a very random thing, I can't seem to find a pattern behind it, and it does still end up taking a picture, but the iris just remains closed. – Jag Feb 29 '12 at 18:05
  • It could be related to the usage of MPMoviePlayerController to generate thumbnails. See my answer here: http://stackoverflow.com/a/10677003/480467 – Werner Altewischer Dec 27 '12 at 14:22

1 Answers1

1

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.

The iOSDev
  • 5,237
  • 7
  • 41
  • 78
  • Sure I will edit my answer with some code, that will show how I used to work with it :). May that will useful to you. – The iOSDev Jul 13 '13 at 05:22