解决定时器在主线程不工作的问题

NSTimer *timer = [NSTimer timerWithTimeInterval:2 target:self selector:@selector(someAction) userInfo:nil repeats:YES];

[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

原文地址:https://www.cnblogs.com/jukaiit/p/5210976.html