开发者

How many times will a repeating NSTimer fire when an application is restored to foreground?

Simple question:

I have a repeating NSTimer (let's say it repeats once every minute).

My application resigns active and the user locks the phone for 15 minutes. The phone is asleep, I am not doing any secret tricks to keep it active like playing an inaudible sound or any开发者_Go百科thing.

When the user unlocks the phone and the application is restored to the foreground, does my timer fire 1 time or 15 times? I believe the answer is 1, I just want to make sure.

Thanks!


Yes. The Timing programming topic says

If the firing time is delayed so far that it passes one or more of the scheduled firing times, the timer is fired only once for that time period; the timer is then rescheduled, after firing, for the next scheduled firing time in the future.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜