I have an NSTimer
running in my application that collects some data and sends it to a server periodically. In production the timer will fire every few hours.
I am worried about interfering with automatic sleep. In testing, some combinations of timer and sleep time prevent automatic sleep entirely — the display sleeps, the system keeps running. Setting my NSTimer
to one minute always stops it.
Some Mac applications are notorious for interfering with automatic sleep when running (or all the time, if they install a daemon). What actions stop the system from sleeping and how can I run periodic tasks safely?