Here is a code I use to init timer:
self.timer = [NSTimer scheduledTimerWithTimeInterval:5.0f
target:self selector:@selector(tick:) userInfo:nil repeats:YES];
NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop];
[currentRunLoop run];
int a = 10;
After calling “[currentRunLoop run];”, “int a = 10;” doesn’t perform.(even after calling tick: method by timer)
Why?
Thank you.
[Run loop run] stops there – it never goes past that line of code it just “loops”
You shouldn’t need to create your own run loop usually.
If you want to achieve a timer on a separate thread just use a timer on the main thread and have the target method perform its work on a separate thread