开发者

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

开发者 https://www.devze.com 2023-01-16 02:09 出处:网络
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

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 a开发者_JAVA技巧nyone 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??


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.


That's a known behavior of the camera application too. I guess you can't do anything to it except freeing as much memory as you can before starting it. You could raise a memoryWarning yourself so every application will receive it and start freeing memory but I have no idea how I can do that. I started investigate sending the notification myself (UIApplicationDidReceiveMemoryWarningNotification) without success. I guess we need to send an object along the notification to define the warning level but I'm really not sure.

0

精彩评论

暂无评论...
验证码 换一张
取 消