user2070420
user2070420

Reputation: 533

Tracking the amount of time iOS app is in background

Is there a way of tracking the amount of time the app is in background and display the same when the app enters foreground in iOS?

Upvotes: 0

Views: 727

Answers (1)

Stuart Sharpe
Stuart Sharpe

Reputation: 601

A simple way could be to save the date into NSUserDefaults in your app delegate's applicationDidEnterBackground: method, then compare the date from the defaults to the current date in your applicationWillEnterForeground: method. Would that work for you?

Upvotes: 5

Related Questions