I'm building a puzzle game app for iPhone. The user have to solve the puzzle on time.
If the user leaves the game (turning of the phone or pushing the big menu button) I would like to clock to keep counting down. Is that possible or would the timer just be paused along with the rest of the game?
You should ask iOS questions on the iOS Developer's Forum. You'll get very insightful answers there.
iOS has some pretty tight controls on what you can do when your app is not in the foreground as they prefer user battery life over developer convenience. Perhaps a better way to handle this would be to capture the "go to sleep" event and record the timestamp. Then capture the wake event and look for captured timestamp and compare. Basically faking the countdown that you could have had that nobody could see anyhow.
Thank you both very much for answering. Very usefull - and I will for sure check out the iOS Developer's Forum.
As wwb said, that is your best option, as once the app leaves the foreground, there is a limited amount of time you have to process any last async code, but it gets paused
This topic is now archived. It is frozen and cannot be changed in any way.