I want to lock users out of my app after a period of being in the background. I'm catching this in the the AppDelegate's applicationWillEnterForeground
(and comparing to time stored in applicationWillResignActive
). If less than the timeout period no action takes place. If more than the timeout period I call:
[_navigationController popToRootViewControllerAnimated:NO];
which brings the user back to the root view.
It works perfectly fine with one visual interruption. The prior view (that which the user was viewing when the application went inactive) appears very briefly before popping to root. In testing it seems the view reappears prior to applicationWillEnterForeground
being called.
The only thought I've had is to hide everything before going inactive, such as by obscuring the view with a filled rectangle. This smells like a dirty hack to me, so I'm thinking there's a better way.
I'm also open to different ways to reach the same end result. Thank you!