Re: Installing a Launchd.plist


 


On Jul 20, 2017, at 5:45 AM, Sandor Szatmari <admin.szatmari.net@...> wrote:

I achieve this with a launchd.plist installed in /Library/LaunchDaemons which simply relaunches the app if the window is ever closed (closing the window terminates the app). 

LaunchDaemons is the wrong directory; that’s for system daemons that run outside of any user context. (I’m surprised you actually got this to work, because it’s difficult to present any UI from a daemon.) LaunchAgents is better, as those are launched into the current login context.

Also, if you want the window to be visible at all times, just don’t make it closable (turn off that checkbox in IB.)

What is the preferred way to install this file for a distributable version of my app?  Do I create an installer?  

That’s one way, or use the authorization API to run a helper shellscript that installs the file.

This seems to be a thing of the past, especially considering the MAS.

You’ll never be able to distribute this via the MAS, because that would require the app to be sandboxed, which prevents it from being able to install the plist. (It’s pretty obvious that altering files in /Library has tremendous potential for malware, and this is the kind of thing sandboxing is designed to protect the user from.)

—Jens

Join cocoa@apple-dev.groups.io to automatically receive all group messages.