I have a problem about using NSTimer and the code is as below, I have simplified the code:
- (void) mainThreadFun
{
[NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(test) userInfo:nil repeats:YES];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(test1) userInfo:nil repeats:YES];
});
}
I found that the NSTimer in the mainThread work but the NSTimer in another thread did not work. Why does this happen and how can I fix this?