•        0

When a process wishes to create connections with other processes, it will first need to configure the middle-man using OEXPCCAgentConfiguration. This class registers a Launchd agent with a unique service name to which OEXPCCAgent will connect. It also declares two methods to generate launch arguments to send to the processes you want to communicate with.Get the defaultConfiguration, create a unique identifier for your background process, and launch the background process with the result of -agentServiceNameProcessArgument and -processIdentifierArgumentForIdentifier:. OEXPCCAgentConfiguration *configuration = [OEXPCCAgentConfiguration defaultConfiguration]; // NSUUID is a good way to get a unique identifier, but you can put anything here. NSString *processIdentifier = [[NSUUID UUID] UUIDString]; NSArray *companionProcessArguments = @[ [configuration agentServiceNameProcessArgument], [configuration processIdentifierArgumentForIdentifier:processIdentifier] ]; // Create and launch the companion process with the service arguments. NSTask *companionProcessTask = [[NSTask alloc] init]; [companionProcessTask setLaunchPath:@"path/to/companion/process"]; [companionProcessTask setArguments:companionProcessArguments]; [companionProcessTask launch];



Related Projects