简体   繁体   中英

How To find Login event in MacOS

I am trying to get notifications during user login and logout events programmatically. As of now I could figure out the logout events by using NSWorkspaceWillPowerOffNotification but not able to figure out the way to receive the login events.

Please let me know the way to get the Login event programmatically.

I did spend some time to look into it, like you said i was unable to find anything that suggest that it "powered on". However there were some behaviours such as NSWorkspaceDidWakeNotification and NSWorkspaceScreensDidWakeNotification to identify screen waking up and screen power. Take alook at the documentation of Apple below Make your way down to the "notifications" section

https://developer.apple.com/documentation/appkit/nsworkspace?language=objc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM