0

I am making an app that is kind of a countdown timer.

I have it all working fine but when the app goes to background the timer stops. The app also goes into background mode as normal.

I've seen apps in the AppStore where the app is always running - the iPhone/iPad never locks itself when this app is in foreground. How can I do that? Do I need to enabled Background modes?

Also how can I make the timer keep running when the app is in background?

Thanks

Joan Cardona
  • 3,463
  • 2
  • 25
  • 43
  • 1
    Hi Joan, what do you want to achieve? That the app is always in the foreground or the screen doesn't lock itself, when the app is in the foreground? – MacUserT May 01 '20 at 16:13
  • @MacUserT that the app doesn't lock itself :) Sorry if it wasn't clear – Joan Cardona May 01 '20 at 16:14
  • 1
    Hi Joan, you can use the following UIApplication.shared.isIdleTimerDisabled to set the screen from going into sleep mode. You can do that on a view controller per view controller basis. Please, check this post: https://stackoverflow.com/questions/12661004/how-to-disable-enable-the-sleep-mode-programmatically-in-ios/12661121#12661121 – MacUserT May 01 '20 at 16:18
  • I am going to close it because of the duplicates. Thanks everyone for your help. – Joan Cardona May 01 '20 at 16:26

0 Answers0