1
我正在嘗試激活scheduledTimerWithTimeInterval不在主線程中。 這是我的代碼。scheduledTimerWithTimeInterval不叫
-(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{
}
任何想法的傢伙?
感謝的人!它工作完美! – Sosily