我有一个问题关于使用的NSTimer和代码如下工作,我已经简化了代码:的NSTimer不会在另一个线程
- (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];
});
}
我发现的NSTimer在mainThread工作,但的NSTimer中另一个线程没有工作。为什么会发生这种情况,我该如何解决这个问题?
可能的重复[如何在后台线程上创建NSTimer?](http://stackoverflow.com/questions/8304702/),[线程和NSTimer问题](http://stackoverflow.com/问题/ 3335114 /),[在NSThread中运行计时器](http://stackoverflow.com/questions/2083737/),[Threaded NSTimer](http://stackoverflow.com/questions/3156452/),[NSThread和NSTimer](http://stackoverflow.com/questions/1338891/) –