0

I want to get clarified or possibly get a solution to a problem that I am facing in terms of restoring state goes. I successfully restore app' state on launch. I restore a view controller and other view controllers in hierarchy that was saved to disk when I pressed home button. Now when I push another view controller and sequence of other view controllers to nav. stack, at a particular view controller, for some reason the app crashes due to an exception. So when I open the app back, it still restores the first view controller's state that was preserved when pressing home button.

Specifically I want to know if there is any way to discard app state info. when app terminates due to uncaught exception? I know that the state will be discarded if user manually force-kills app, or state restoration fails, or the app terminates at launch. Is there a way to catch a termination when it occurs, and we configure app state accordingly? Suggestions would be great. Thanks.

badhanganesh
  • 3,211
  • 2
  • 17
  • 34
  • Fix the bug that causes the exception. – Paulw11 Dec 31 '16 at 08:09
  • I fixed the exception. Wanting to know if discarding state manually in iOS is possible. It would be ugly if, after a crash the app restores to a different screen rather than to the screen that was there when the app crashed. I want to present/restore the user view controller(s) in logical fashion. – badhanganesh Dec 31 '16 at 08:15
  • If you want to discard saved state when app entered in background, Call popToRootviewcontroller when app enters background – PlusInfosys Dec 31 '16 at 11:05

0 Answers0