Parent ViewController deallocated upon memory warning
I have a MainViewController, from which a new VideoPageViewController is presented modally. In the ViewPageViewController, it will load a web page and launch the video, which is a heavy operation and sometimes causes memory warning. When it is ready to return to the MainViewController by dismissModalVie开发者_高级运维wController, it says the MainViewController is already deallocated! The app thus crashes.
This happens sometimes, but not always.
Is there any exception handling I can take on it? Can I recreate the parent view controller? HELP!
Thanks
Just retain the MainViewController so it's not released when that happens.
You can probably do that in your application delegate, or in the class that owns it.
Remember to release it when/if you are done using it, so it's properly disposed of.
精彩评论