Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImagePickerController in camera mode gets 'stuck' with the shutter closed

Occasionally in low-memory conditions the UIImagePickerController I use gets 'stuck' with the shutter closed. Generally when this the WatchDog is allready jettisoning other background apps so within a second or two the low memory condition is over, yet the UIImagePicker controller is still stuck.

Has anyone else encountered this and implemented any sort of workaround or found a way to detect when the picker is in this state, so that it can be removed and a new one put in its place.

Thoughts / Ideas / Solutions??

like image 337
Brad The App Guy Avatar asked Sep 09 '10 19:09

Brad The App Guy


1 Answers

Have you tried allocating (and then freeing) a megabyte or two of memory using malloc() before starting the UIImagePicker? Or claim it slightly earlier in your app, and then release it when you want to show the picker.

I guess you should be able to see roughly the amount of memory UIImagePicker needs to run successfully by running your app inside of instruments.

Whilst not ideal, it should cause other apps to be given memory warnings earlier on and hence the UIImagePicker should then have enough memory to run.

like image 167
JosephH Avatar answered Nov 05 '22 09:11

JosephH