didFinishPickingMediaWithInfo is not called after receive memory warnings
I am using the UIImagePickerViewController to take a photo in my app, but in iOS4+, which supports multi-tasking, I encountered a memory problem. If you've opened a lot of apps, and then mine, the UIImagePickerViewController does not work properly anymore. The picker controller some times get closed without calling the delegate method, sometimes the whole app crashes. Of coz, the memory warnings are already received, but what can I do? Dismiss the pickerController when receiving the 1st memory warning, and alert the user that he has to kill as many suspended app开发者_StackOverflows as possible and retry? This is really not a nice user experience? But if I do not do so, a crash or a sudden close of the pickerController also confuses the user. Did anyone meet and solve the same problem?
UIImagePickerViewController is notorious for throwing memory warnings. If you don't want to be in the business of making sure everything is ready to unload if you get those warnings then I recommend you switch to AV Foundation instead.
This SO answer has a link to a tutorial which may get you started in that direction. AVFoundation camera tutorial
精彩评论