Interval Training App with Timer running on the background

Hello everyone,


I've been developing an Interval Training App for iOS using SWIFT using a Timer Object. Everything is working perfectly with the App except when it goes on the background.


For example, if a user exist the app to go to another app (for example a music app) the Timer stops and everything stops on the App. Does anyone know how to deal with this situation? I've seen many apps similar to mine working perfectly when they go on the background (for example "IntervalTimer" ou "HIIT & Tabata").


Thanks in advance.

Replies

Shortly after the user moves your app to the background, the system suspends it. At that point no code is running in your app, which is why you timers don’t run.

There are various ways you can deal with this, but the best way depends on your specific situation. What are you doing when your timers fire?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I'm having the exact same problem. I have a task with multiple timers connected and when one completes, the others should run automatically. I also want to give a completion notification with TTS on completion. How can this be implemented in this case?