异步线程中开启定时器

异步线程中开启定时器---

dispatch_queue_t concurrentDiapatchQueue=dispatch_queue_create("com.test.queue", DISPATCH_QUEUE_CONCURRENT);
    dispatch_async(concurrentDiapatchQueue, ^{
        [[NSRunLoop currentRunLoop] run];
        [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(reloadMainTab) userInfo:nil repeats:YES];
    });

需要开启[[NSRunLoop currentRunLoop] run];

如果不开启RunLoop

则不需要使用NSTimer ,使用GCD就行了!!

原文地址:https://www.cnblogs.com/110-913-1025/p/8611012.html