Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Difference in scheduling NSTimer in main thread and background thread?

When I call scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: on the main thread and set time interval to 5 seconds code below timer gets executed, and after 5 seconds timer selector is called.
But if I try same in some background thread, the code below scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: will not be executed, it will wait for the timer to fire and then gets executed. Of course, in order to run the timer in the background thread, I first got an instance of NSRunLoop and run it.
Is there a way to set the timer in the background thread and make it non-blocking, so code after it gets executed immediately?

Comments