I found that UIImagePickerController can unload your parent view, especially if you bring up the camera, resulting in viewDidLoad being called again. I understand that this happens due to low memory. But I was storing the UIImage* from imagePickerController:didFinishPickingMediaWithInfo in the view controller. This data is lost after a reload. (The self pointer for the view controller has changed, and the UIImage* is null.) So is it a bad idea to store such variables in the view controller? Where should they be stored – in a global (singleton) object?
Thanks
This is not really good advice to actually solve your problem, but ignoring the memory warning will in this case help a lot:
in your view controller will solve this.
A place to store objects you really need, could be the app delegate, since it will not unload on memory warnings. (any place not responding to memory warnings will do)