Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>XPC isn't an option if you're trying to elevate privileges (from <a href="https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingXPCServices.html">https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingXPCServices.html</a>):</p> <blockquote> <p>By default, XPC services are run in the most restricted environment possible—sandboxed with minimal filesystem access, network access, and so on. Elevating a service’s privileges to root is not supported.</p> </blockquote> <p>SMJobBless will install a helper tool and register it with Launchd, as in the SMJobBless example provided by Apple. The trick to getting your helper tool to actually launch is to simply attempt to connect to your helper tool's advertised services.</p> <p>There was a WWDC2010 example called <code>ssd</code> that demonstrated a simple launchd client/server model via sockets. It's not available from Apple any longer, but I've found a link here: <a href="http://lists.apple.com/archives/macnetworkprog/2011/Jul/msg00005.html">http://lists.apple.com/archives/macnetworkprog/2011/Jul/msg00005.html</a></p> <p>I've incorporated the dispatch queue handling in the server code from the ssd example into the helper tool in the SMJobBless example and can confirm that my helper tool is indeed running (as root) when my main app attempts a connection on the appropriate port. See the WWDC2010 video on Launchd to understand the other mechanisms with which you can communicate with your helper tool (other than sockets).</p> <p>I'm not sure I can legally redistribute the modified sources I have, but it should be fairly straightforward to merge the two projects and get your helper tool running.</p> <p><strong>Edit:</strong> Here is an example project I wrote that uses a distributed object for communication between the app and helper: <a href="http://dl.dropbox.com/u/463624/Elevator.zip">http://dl.dropbox.com/u/463624/Elevator.zip</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload