Note that there are some explanatory texts on larger screens.

plurals
  1. POCan CARemoteLayerServer and CARemoteLayerClient be used between processes?
    text
    copied!<p>In Mac OS X Lion CARemoteLayerServer and CARemoteLayerClient were added to QuartzCore. I've been trying to investigate if they'd be suitable for splitting a graphical application between multiple processes, but without success.</p> <p>I can use them successfully within a single process, with some code along the lines of this:</p> <pre><code>- (void)buildLayerSingleProcess { CARemoteLayerServer *server = [CARemoteLayerServer sharedServer]; self.client = [[CARemoteLayerClient alloc] initWithServerPort: server.serverPort]; uint32_t clientID = self.client.clientId; CALayer *layer1 = [CALayer layer]; layer1.bounds = CGRectMake(0.0, 0.0, 100.0, 100.0); CGColorRef color = CGColorCreateGenericRGB(0.4, 0.2, 0.3, 1.0); [layer1 setBackgroundColor: color]; CFRelease(color); [layer1 setOpacity: 0.75]; [layer1 setBorderWidth: 5.0f]; layer1.position = CGPointMake([[self.window contentView] frame].size.width / 2.0, [[self.window contentView] frame ].size.height / 2.0); self.client.layer = layer2; CALayer *servedLayer = [CALayer layerWithRemoteClientId: self.client.clientId]; [[[self.window contentView] layer] addSublayer: servedLayer]; } </code></pre> <p>Which is nice, but I'd like to try and do something similar between processes. The fact that server.serverPort is of type mach_port_t implies that it'd be suitable for use between processes.</p> <p>However, when I split that code up to run in two processes (either two individual apps, or a main process and an XPC service), when I try to initialise the CARemoteLayerClient with the mach_port_t from the server in the other process I get:</p> <pre><code>unable to register with server: 0x10000003 </code></pre> <p>It may well be they're not suited for between random processes, but the use of mach_port_t kinda implies that.</p> <p>Has anyone else had any success using these classes between processes?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload