1

I'm currently wondering if it is possible, just like on iOS the somehow have a delegate called once OSX returns from hibernate mode, e.g. on opening the MacBook from sleeping?

I had a look at the NSApplication delegates here: Apple NSApplicationDelegate Protocol but couldn't find anything helpful.

On iOS the closest thing that comes to it is may the - applicationWillEnterForeground: that is documented in the Apple UIApplicationDelegate Protocol.

Is there any way to do this?

UPDATE

Reliable way to get a machine wake + user logged in notification in Cocoa? exactly solves this question!

[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
                 selector:@selector(wakeFromSleep:)
                     name:NSWorkspaceDidWakeNotification
                   object:nil];
Community
  • 1
  • 1
Thomas Fankhauser
  • 5,039
  • 1
  • 33
  • 32
  • 1
    possible duplicate of [Reliable way to get a machine wake + user logged in notification in Cocoa?](http://stackoverflow.com/questions/9402179/reliable-way-to-get-a-machine-wake-user-logged-in-notification-in-cocoa) – Rob Keniger Feb 23 '12 at 13:07
  • Absolutely! Great, thank you Rob. – Thomas Fankhauser Feb 23 '12 at 13:30
  • Does this answer your question? [Reliable way to get a machine wake + user logged in notification in Cocoa?](https://stackoverflow.com/questions/9402179/reliable-way-to-get-a-machine-wake-user-logged-in-notification-in-cocoa) – Ted Klein Bergman Mar 24 '21 at 13:22

0 Answers0