• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Wake from sleep notifications and preventing idle sleep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wake from sleep notifications and preventing idle sleep


  • Subject: Re: Wake from sleep notifications and preventing idle sleep
  • From: Dan Messing <email@hidden>
  • Date: Tue, 21 Mar 2006 14:15:15 -0600

When I first tried to use the NSWorkspaceDidWakeNotification and NSWorkspaceWillSleepNotification notifications I also ran into problems because I didn't realize that I had to register with NSWorkspace's notification center instead of the defaultNotificationCenter:

[[NSWorkspace sharedWorkspace] notificationCenter]

instead of:

[NSNotificationCenter defaultCenter]

Of course your solution has already solved the problem for you, I just wanted to add this in case anybody else was running into the same problem.

Dan Messing
Stunt Software
http://www.stuntsoftware.com/



On Mar 21, 2006, at 1:58 PM, email@hidden wrote:

I've never beeng able to get the NSWorkspaceDidWakeNotification to
work, and I was going to post to the list asking about this but first
did some extra research and came up with a wrapper class that
provides the functionality I was looking for.

Since this may be useful to others, I'd like to share it. The class
also happens to be the first entry in what I hope to be a useful
database of cocoa code that I've recently written.

The class posts a notification when the computer is about to sleep or
when waking from sleep. It also implements a delegate method that can
prevent idle sleep from happening, if for example your program needs
to complete a lengthy operation without being interrupted.

For more info about the class: http://developer.phildow.net/cocoa-
code/pdpowermanagement/

Feel free to use it in any way you can.
-Phil

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Wake from sleep notifications and preventing idle sleep
      • From: Philip Dow <email@hidden>
  • Prev by Date: Re: Small Bindings problem
  • Next by Date: Re: C strings
  • Previous by thread: Wake from sleep notifications and preventing idle sleep
  • Next by thread: Re: Wake from sleep notifications and preventing idle sleep
  • Index(es):
    • Date
    • Thread