Reputation: 7504
I have just noticed that my timer callback function stops firing when iPhone screen gets locked. Is there anyway to tell iPhone to keep awake my timer? Any other way to do things periodically when iPhone is locked?
I am using NSTimer from viewDidLoad to schedule timer call back function every second.
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(levelTimerCallback) userInfo:nil repeats:YES];
Thanks.
Upvotes: 2
Views: 1877
Reputation: 8237
You sure it's not running when locked? I just tried it, put that scheduleTimerWithTimeInterval in the app delegate's didFinishLaunching method, locked screen on simulator, and still get the callbacks.
Upvotes: 1