I have a Xpc Helper, which is local to my App (that is only my App can talk to 
it) which works fine.

Now I want to convert this Xpc Helper into a LaunchAgent.

I guess I have to start it via SMJobSubmit().
But when I do this with the existing Helper, it crashes, gets restarted, 
crashes again, etc. ad infinitum.

So the Helper must be modified as well. But how?

And is this the right way to start it?

let mach = [ "de.mdenkmann.Xpc-Exchange" : true ]
let args = [ "/private/tmp/Xpc Exchange.xpc/Contents/MacOS/Xpc Exchange" ]
let job =       [       "Label"                                 : 
"de.mdenkmann.Xpc-Exchange",
                        "LimitLoadToSessionType"        : "Background",         
                        "MachServices"                  : mach,
                        "StandardErrorPath"             : "/tmp/Xpc 
Exchange.log",
                        "ProgramArguments"              : args
                ]
var outError : Unmanaged<CFError>?
var auth : Authorization?               
let ok  = SMJobSubmit( kSMDomainUserLaunchd, job, auth, &outError ) 
ok = true, but then: crash with: "xpc_main() was probably called from a process 
that is not an XPC service bundle."

Gerriet.


P.S. 

SMJobSubmit is deprecated in 10.10. But the documentation mentions no 
replacement.
What to use instead?


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to