Make NSTimer fire even when the machine is in sleep mode.

The default behavior of NSTimer to fire a registered selector is to count only for the duration of the time the machine is awake. So, If you set it to fire in 1 min, and you have your Mac sleep in 30 sec for 10 sec, it should fire in 1min 10sec.
However, whether your machine is in sleeping mode or not, there will be cases where you want to fire it in 1 min. At Noodling’s blog, there is a great post for it.

Noodling’s Playing with NSTimer

About these ads

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 48 other followers

%d bloggers like this: