start from a init viewcontroller in force

Hi ,


I want to check login state in func applicationWillEnterForeground,

and if it is logouted by login period expiring, I want to all start from init viewconroller(start point of storyboard).

I want to all variables are back to init state.

(this is why I said 'start from a init')

Any idea plz ? 🙂

Thanks

Accepted Reply

It's mostly just a matter of keeping track of state. You'll need to know when the login period started (a Date value), and whether the login view controller is currently presented (a Bool value).


When you app comes back to the foreground, check if the login has expired. If so, check if the login view controller is already presented. If so, dismiss it. Then present the login view controller, which will presumably reset its content.


Something like that, anyway.

Replies

It's mostly just a matter of keeping track of state. You'll need to know when the login period started (a Date value), and whether the login view controller is currently presented (a Bool value).


When you app comes back to the foreground, check if the login has expired. If so, check if the login view controller is already presented. If so, dismiss it. Then present the login view controller, which will presumably reset its content.


Something like that, anyway.