NSTimer not firing when computer is inactive for a while.
NSTimer not firing when computer is inactive for a while.
- Subject: NSTimer not firing when computer is inactive for a while.
- From: Nathan Day <email@hidden>
- Date: Wed, 15 Nov 2017 00:43:38 +0000 (GMT)
I have a background process that uses an NSTimer that is set to fire every
minute, but when the computer is inactive for a while it will stop firing, its
not until someone interacts with the computer the timer will start firing
again. The timer is added to the main NSRunLoop, maybe the NSRunLoop needs to
be kept active by user interaction, the background app has a status menu bar
item to provide feedback when its active and provide a simple menu for basic
user control.
I have checked "Prevent computer from sleeping automatically when the display is off" in
Energy Saver, I have also tried setting "Turn display off after" to never but it doesn't
make a difference, these are things we can control on the users machines because it runs on company
computers.
The background app is kept alive by launchd as a User Agent and looks for new
resources to be downloaded periodically, it needs to start downloading these
resources not to long after they are available, they can take hours to download
in some case, and they need to be available when the user returns to their
computer. There is also a foreground app that talks to the background app to
display the downloaded resources, a bit like iTunes and iTunes Helper.
Nathan Day
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden