关闭后,我有一个要数长达8小时(28800秒) 之后,它应该被释放的NSTimer继续计数的应用程序在iPhone
即时知道如何保持计时器在后台运行的定时器和/或应用程序关闭了吗?
这是的NSTimer:
stopWatchTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(updateTimer)
userInfo:nil
repeats:YES];
,这是我的情况:
counter++;
if (counter >= 28800) {
[stopWatchTimer invalidate];
counter =0;
timeLabel.text = @"Time Out";
}
也许你可以找到答案,在这个线程 http://stackoverflow.com/questions/4154332/ios4-create-background-timer –
如何使用它? – Mutawe