kschins
kschins

Reputation: 1224

Logging user out after app idles in background

What is the best way to approach logging a user out of the application if the app has been in the background for a certain period of time?

My current approach: save time to NSUserDefaults when applicationDidEnterBackground: then when applicationWillEnterForeground: is called check the saved time, if timer interval is greater than specified time I post a notification which handles logging the user out.

Is there a better way to do this?

Upvotes: 2

Views: 145

Answers (1)

Undo
Undo

Reputation: 25687

Sounds good.

That seems to be how most apps with an account-block thingy do it - you open the app up and it shows you your content for a split second, then brings up the login page.

It's kind of maddening, having to type in an ultra-secure password we all use, right?*


*'horsebatterystaple'

Upvotes: 3

Related Questions