Is there anything better than NSTimer when time is absolutely important?

I remember that there were some bizarre, superspecial types or CALayer classes for cases where time was critical to the application. I want a CALayer flash at a specific frequency that triggers an ambient light sensor and transmits light data. Similar to IR remote control. This is an experiment. I need it to flash from 5 to 50 times per second, with different durations from 0.02 to 0.2 seconds.

NSTimer just bounces something in the startup loop, but I think it does not guarantee anything. I even remember that it may happen that some callbacks just drop out, so this is not very good for critical high-precision synchronization, right?

Can anyone remember what CALayer sync / sync stuff is that can help? Or is OpenGLES my best friend here?

+3
source share
1 answer

CADisplayLink - this will give you permission to update the screen.

+2
source

Source: https://habr.com/ru/post/1766534/


All Articles