I use UIImagePickerController to take a photo from a camera. However, I find that my calling controller (the one shown before the UIImagePickercontroller is displayed) is randomly unloaded. I registered viewDidUnload, and indeed, it is called. When the camera is completed and fired, my viewDidLoad dispatcher will be called, unfortunately, all the state has now disappeared. Things like typed text or selected items disappear.
Obviously, this is due to exhaustion of memory. But is this behavior normal? Should I handle it? This is not typical of how modalViewController works. Usually you show it and reject, everything should be intact.
What is a good way to avoid data loss in this case? Do I have to write a bunch of code to keep the full state?
source
share