How to switch to login window using obj-c on Mac OS 10.6+

I have an app and I need to navigate to a Login window programmatically similar to this app:



source to share

2 answers

If you want to switch user:

/System/Library/CoreServices/Menu\ Extras/ -switchToUserID UserID


for UserID

id -u userName


For login window

/System/Library/CoreServices/Menu\ Extras/ -suspend




You are sending the Apple event "aevtlogo" Apple to the application loginwindow

. Have a look at the documentation for the classes NSAppleEvent<Foo>