Hi all,
I've got a an OS X application that needs to perform some privileged
operations, so I've written a privileged helper tool (PHT) and it all works
fine to call the necessary functions from my user-land application and get the
response.
What I'm struggling with is some additional communication between the helper
tool and my application during lengthy operations, so the application can
provide some visual feedback to the user.
I need to support 10.6, so NSXPCConnection is out of the question. I've tried
Distributed Objects as well as CFMessagePort/NSMessagePort but neither seems to
work.
For DO, I can successfully vend the object within my GUI application, but I'm
unable to connect from my helper tool. When doing the following in the PHT, I
always get the log message saying "couldn't connect", and the method in my
application doesn't get called.
NSConnection *theConnection = [NSConnection
connectionWithRegisteredName: @"uk.co.blahblahconnection" host:nil];
if (!theConnection) {
asl_log(logClient, NULL, ASL_LEVEL_ERR, "Couldn't connect");
}
id myServer = [theConnection rootProxy];
if (!myServer) {
asl_log(logClient, NULL, ASL_LEVEL_ERR, "myServer is nil");
}
[myServer setProtocolForProxy:@protocol(MyServerProtocol)];
asl_log(logClient, NULL, ASL_LEVEL_ERR, "Function returned
%d",[myServer myServerFunction]);
If I use the exact same code in a new project (GUI application), it works
absolutely fine!
I assumed that that meant DO isn't permitted from a PHT (despite being
permitted over a network, therefore connecting from a different user on a
different machine entirely), so dug a bit lower and tried NSMessagePort instead.
Unfortunately, this gives me the exact same issue:
CFMessagePortRef remotePort = CFMessagePortCreateRemote(NULL,
CFSTR("com.example.app.port.server"));
if (!remotePort) {
asl_log(asl, aslMsg, ASL_LEVEL_ERR, "no remote port");
}
When using the above code in my PHT, I get "no remote port" in the console log,
however, trying it from a completely new GUI application project, it works
absolutely fine.
Googling/Ducking (DuckDuckGoing?) didn't turn up anything I hadn't already
tried, and the search on CocoaBuilder.com isn't working.
Am I missing something? Is there a way to do what I'm looking for, or am I
just barking up the wrong tree entirely?
Thanks
Mark
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]