开发者

UIImagePickerController does not dismiss after memory warning

开发者 https://www.devze.com 2023-01-05 07:11 出处:网络
I have a UIImagePickerController as a synthesized property of my view controller. In general it works fine (takeing/picking photos, calling back, etc). However, when I receive a memory warning (didRe

I have a UIImagePickerController as a synthesized property of my view controller.

In general it works fine (takeing/picking photos, calling back, etc). However, when I receive a memory warning (didReceiveMemoryWarning is called on the view controller), although the app seems to handle it gracefully (viewDidLoad gets called for the view to get set up again without any extraneous views etc - app doesn't crash) and the UIImagePickerController lets me take a photo, the UIImagePickerController's view (in this case the camera) doesn't get dismissed. The camera just stays on the screen with the Retake and Use buttons greyed out.

I have tried setting self.imagePicker = nil in viewDidUnload and have also tried NOT doing this (so the view controller hasn't 'forgotten' it when it needs to dismiss it after th开发者_如何学Ce memory warning).

After the photo is taken after the memory warning, the imagePicker does callback successfully (didFinishPickingMediaWithInfo), but the imagePicker view remains on the screen.

Any help/ideas would be greatly appreciated.


Thanks very much to Kalle for commenting and, basically, solving the issue.

The answer was that I not only needed to make sure the imagePicker wasn't being set to nil in viewDidUnload, but I then needed to remove/dismiss it in didReceiveMemoryWarning. So simple when you know the answer - doh!! ;o)

Thanks again, StackOverflow.

0

精彩评论

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