I had this same question today, and found a different (in my opinion, simpler) way to achieve this. Basically, you can create a launchd job which runs your app when the user logs in.
You'll need to define a job in the form of a .plist file (it's XML), which looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.capablemonkey.sleepApp</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/open</string>
<string>-W</string>
<string>/Applications/sleep.app</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
From there, assuming you can make your Cocoa app run some command line commands, you'll want to copy your file to ~/Library/LaunchAgents/:
cp com.capablemonkey.sleepApp.plist ~/Library/LaunchAgents/
and then tell launchd to run your new job:
launchctl load ~/Library/LaunchAgents/com.capablemonkey.sleepApp.plist
See my blog post for a deeper dive and examples in node.js. It describes ways to also undo this should the user decide to not have your app run on login, and to check to see if the launchd job is currently active.