直到昨天,我确信NSTimer将在应用程序进入后台后停止。我有一种感觉就像遇到了一些异常情况。NSTimer在应用程序进入后台后不会停止
我的应用程序有更新位置和播放音频背景模式。更新位置每隔几秒刷新一次。但它只发生在其中一个应用程序屏幕上。还有NSTimer刷新一些用户界面。
我安排这样的:
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTime) userInfo:nil repeats:YES];
还有一种方法,它的内容是现在无关紧要:
-(void)updateTime
{
//irrelevant content, but the method gets fired even when the app is in background
}
奇怪的是,thah的方法,这是唯一的由NSTimer发射,现在甚至在AP进入背景后也被解雇。这里发生了什么?这是正常的行为吗?
你的计时器在哪里声明? – iPatel
viewWill ViewController的出现 –