相关疑难解决方法(0)

应用程序在后台时预定的NSTimer?

当应用程序在后台时,人们如何处理预定的NSTimer?

假设我每小时在我的应用中更新一些内容.

updateTimer = [NSTimer scheduledTimerWithTimeInterval:60.0*60.0 
target:self 
selector:@selector(updateStuff) 
userInfo:nil 
repeats:YES];
Run Code Online (Sandbox Code Playgroud)

在后台时,此计时器显然不会触发(?).当用户回到应用程序时应该怎么办?计时器是否仍然在运行,同一时间?

如果用户在一小时内回来,会发生什么.它会在错过的所有时间触发,还是等到下一次更新时间?

我想要它做的是在应用程序进入前台后立即更新,如果它应该触发的日期是过去的.那可能吗?

iphone nstimer uiapplicationdelegate ios

54
推荐指数
5
解决办法
7万
查看次数

标签 统计

ios ×1

iphone ×1

nstimer ×1

uiapplicationdelegate ×1