Launching a mac app upon login AND keeping it running forever

I did some research and found that we can add our app by bundling a 'helper app' inside the main app's Contents/Library/LoginItems. Then in the main app (say from app delegate didlaunchwithoptions), call SMLoginItemSetEnabled and pass it the bundle identifier of the helper app and flag=true.

This is way, when the main app is launched, it will configure the helper app as the 'login item', and that helper app will be launched automatically upon system login.

Then in the helper app launch process, check if the 'main app' is not running, open it by using its path/url.

But we also want that users are not able to quit (or force-quit) the main app (it's a security app). Or at least, if they kill the app, it should be relaunched automatically.

Will just doing the above achieve all this?

  • app should be launched upon system login
  • app should be launched if it's killed by any way

If not, what are the options?

But we also want that users are not able to quit … the main app … Or at least, if they kill the app, it should be relaunched automatically.

Are you distributing via the Mac App Store? Or independently, using Developer ID signing?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Launching a mac app upon login AND keeping it running forever
 
 
Q