How to make a LaunchAgent
How to make a LaunchAgent
- Subject: How to make a LaunchAgent
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Mon, 11 Aug 2014 17:07:01 +0700
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 (email@hidden)
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:
This email sent to email@hidden