Re: Debugging a privileged helper
Stephane Sudre wrote: Have you tried removing the Program entry? That's produced, as far as I can tell, by the SMJobBless process. The file I pass is: "http://www.apple.com/DTDs/PropertyList-1.0.dtd;> Label org.sil.KLMHelper MachServices org.sil.KLMHelper It's added to the binary with the linker flag -sectcreate __TEXT __launchd_plist (path to the file). The launchd plist is exactly analogous to the tool that is already working, just the identifiers changed. -- John Brownie In Finland on furlough from SIL Papua New Guinea ___ 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
Re: Debugging a privileged helper
Damien DeVille wrote: Are you specifying the MachService you use for your XPC connection in your launchd job? I believe so. The launchd plist is: == "http://www.apple.com/DTDs/PropertyList-1.0.dtd;> Label org.sil.KLMHelper MachServices org.sil.KLMHelper Program /Library/PrivilegedHelperTools/org.sil.KLMHelper ProgramArguments /Library/PrivilegedHelperTools/org.sil.KLMHelper == The code to connect to the helper is: == helperToolConnection = NSXPCConnection.init(machServiceName: toolIdentifier, options: NSXPCConnection.Options.privileged) helperToolConnection?.remoteObjectInterface = NSXPCInterface.init(with: Keyboard_Layout_HelperProtocol.self) helperToolConnection?.invalidationHandler = { self.helperToolConnection?.invalidationHandler = nil OperationQueue.main.addOperation({ self.helperToolConnection = nil }) } == where toolIdentifier is "org.sil.KLMHelper" The code that invokes the code is like this: == let connection = connectionManager.helperToolConnection let proxy = connection?.remoteObjectProxyWithErrorHandler { (error) in NSApp.presentError(error) } as! Keyboard_Layout_HelperProtocol let authorization = connectionManager.authorization // Call the proxy with the appropriate code proxy.authenticatedCreateDirectory(url: location, authorization: authorization) { handler($0, $1) } == All of this is derived from Even Better Authorization Sample, translated to Swift. -- John Brownie In Finland on furlough from SIL Papua New Guinea ___ 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
Re: Debugging a privileged helper
Are you specifying the MachService you use for your XPC connection in your launchd job? On Thu, Jan 26, 2017, at 10:30 AM, John Brownie wrote: > I have a working app in Objective-C that has a privileged helper. I am > creating a different app, this time in Swift, and need a privileged > helper. As far as I can tell, I have mirrored all the appropriate > settings, but it's not working. > > Calling SMJobBless succeeds, and the job is installed appropriately in > /Library/LaunchDaemons and /Library/PrivilegedHelperTools. However, when > I try to activate it via NSXPCConnection, all appears to be fine in the > host app, but the helper tool never launches, as far as I can tell. I've > run out of places to look for problems, so I need some more ideas on how > to track down the problem. Any suggestions? > > Thanks in advance! > -- > John Brownie > In Finland on furlough from SIL Papua New Guinea > ___ > > 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/damien%40ddeville.me > > This email sent to dam...@ddeville.me ___ 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
Debugging a privileged helper
I have a working app in Objective-C that has a privileged helper. I am creating a different app, this time in Swift, and need a privileged helper. As far as I can tell, I have mirrored all the appropriate settings, but it's not working. Calling SMJobBless succeeds, and the job is installed appropriately in /Library/LaunchDaemons and /Library/PrivilegedHelperTools. However, when I try to activate it via NSXPCConnection, all appears to be fine in the host app, but the helper tool never launches, as far as I can tell. I've run out of places to look for problems, so I need some more ideas on how to track down the problem. Any suggestions? Thanks in advance! -- John Brownie In Finland on furlough from SIL Papua New Guinea ___ 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