I’m trying to figure out a way to have a timer that begins at the time that an app is installed and continues to run even when the app is in the background. I’m basically using the timer to periodically check the battery life of an external device that is linked to the phone. I’ve been told that the best way to do this is to use some sort of delegate calls to a timer function, but I’m fairly new to IOS and am pretty confused on how to do that. I know how to set up the timer and get the battery life, I’m however perplexed on how to keep the timer going through the life of the app. Any help you could give would be extreeemely appreciated! Thanks a bunch!
Share
Running an app in the background (forever) isn’t possible.
But while your app is running… you can set the
repeatsparameter of the methodscheduledTimerWithInterval:target:selector:userInfo:repeats:toYES.Here’s a link to running it in the background for a certain period of time to perform a relatively large task.