iosnstimercfrunloop

NSTimer v/s CFRunLoopTimer


My question is which one is better to use?

As NSTimer in turn uses the CFRunLoopTimer object. What works better then other i got nothing about it on any site i googled for it but nothing, i got documents regarding both from Apple's documents but after reading them i doesn't understand or clear about what to use NSTimer or CFRunLoopTimer? any help will be appreciated.


Solution

  • From the docs:

    CFRunLoopTimer is “toll-free bridged” with its Cocoa Foundation counterpart, NSTimer.

    Translation:

    It doesn’t matter, so use NSTimer unless you’re knee deep in CF-code anyways or want to do funky stuff/associate non-object data with your timer.