For the sake of learning i’m making a timer. Used an NSTimer but it appears this stops
when going to the background.
Thought of using NSDate instead. Does this work in the background?
Do i compare current time to a set time to get the timer running properly?
Some thoughts would be greatly appreciated!
For the sake of learning i’m making a timer. Used an NSTimer but it
Share
If you are looking for something to handle time based events in the background, have a look at
UILocalNotification. With a local notification, the OS will alert the user at the appointed time whether the app that scheduled the notification is running or not.If you are looking for something to happen when the app starts, you can use
NSUserDefaultsand store a value containing the current timestamp. Fire this off when in the AppDelegate insideapplicationWillResignActivemethod. You can then check this value in theapplicationDidBecomeActive.