I have been trying to run a timer in the background for my application in Xcode and have attempted multiple solutions. Funny enough, most of the solutions work on the simulator and not on the phone. Some of the links to the solution I attempted are listed below:
Asked
Active
Viewed 147 times
1 Answers
0
You cannot run Timers in the background on iOS (search SO for "ios timer background" and you'll find numerous discussions). The fact that it works in the Simulator doesn't mean anything. The Simulator doesn't reimplement every part of iOS (it's a simulator, not a full emulator; it runs on macOS, not iOS; that's why you have to compile for the simulator, you can't just run IPAs directly on it), and when you run things under Xcode, you're exempted from many rules.
How you run specific things in the background depends on precisely what you're trying to do. There is no single "run in the background" tool. That intentionally doesn't exist on iOS. Your exact use case will determine which of the various tools you should use.

Rob Napier
- 286,113
- 34
- 456
- 610