April 2015
Intermediate to advanced
556 pages
17h 47m
English
Timers rely on the run loop to fire. When a timer is scheduled it calculates the next time that it should fire and asks the run loop to inform it when that time has arrived. NSTimer is fine for general purpose delays but is not suitable for cases where events must be fired with high resolution. It is documented to have a resolution on the order of 50-100ms.
For cases where timer resolution is not critical, NSTimer supports timer coalescing. By setting the tolerance property you can allow the system to massage the firing of all of the timers to happen at once, resulting in significant improvements in energy usage.
Read now
Unlock full access