I have a timer that continuously executes a function, but it stops whenever the user exits the app, changes to a different view, or closes the app. How can I keep the timer active and running in each of those scenarios?
Asked
Active
Viewed 756 times
1
-
1Did you have a look at the "Related" questions, such as https://stackoverflow.com/questions/34850390/ios-timer-in-the-background?rq=1m, https://stackoverflow.com/questions/40644452/running-a-timer-that-counts-down-in-background-when-app-isnt-the-focus-swift?rq=1, https://stackoverflow.com/questions/41645143/time-app-can-run-in-background-swift?rq=1, https://stackoverflow.com/questions/44416417/should-i-invalidate-timer-when-my-application-is-suspended-or-in-background?rq=1? – Martin R Jul 03 '17 at 05:07
-
1timer.invalidate() not call And Refer this https://stackoverflow.com/questions/8415870/scheduled-nstimer-when-app-is-in-background – BHAVIK Jul 03 '17 at 05:17
-
Did you ever get this working for you app? – WBuck Feb 23 '18 at 22:20
1 Answers
0
Maybe save the time on database and pull the time whenever user open the apps again.

Rick
- 541
- 1
- 8
- 22