我正在尝试激活不在主线程中的 scheduleTimerWithTimeInterval。这是我的代码。
-(void)setMidnightUpdate{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
0), ^{
if(midnightTimer && [midnightTimer isValid]) {
[midnightTimer invalidate];
midnightTimer = nil;
}
secs = 10;
midnightTimer = [NSTimer scheduledTimerWithTimeInterval:secs
target:self
selector:@selector(midnightUpdate)
userInfo:nil
repeats:NO];
});
-(void)midnightUpdate{
}
有什么想法吗?