NSTimer doesn’t work well or can’t call desired method on time if time interval is less then 0.5 seconds or in neno seconds so i just want to know is there any alternative of NSTimer which can work for time interval less then 0.5 seconds?
Thanks in advance
Before anything, the precision is much better than half a second. My tests give good results even at 100 ms.
The problem isn’t the fire delay, it’s the leeway: essentially, timers are polled at a certain interval, and if the delay is close to that interval, you might run into problems. For instance, assume that timers are checked every 30 ms, and that you have a timer scheduled in 31 ms. 30 ms later, it still isn’t due, so it doesn’t trigger; however, the next check will be done 30 ms later, and as such your timer will actually be triggered 60 ms after its start instead of 31.
If you really need better than that, you can use Grand Central Dispatch timers. You may get suboptimal results if you dispatch on the main queue, though.