xpc api

Can XPC shared memory be used if the app & extension is using the NSXPCConnection instead of the XPC Services API?

Replies

Yes. In 10.14 and later you can transport arbitrary low-level XPC types across

NSXPCConnection
using
-setXPCType:forSelector:argumentIndex:ofReply:
. However, it’s possible to do this on older systems as well: The trick is to use the Posix shared memory API (see the
shm_open
man page), which works in terms of file descriptors. You can then wrap that file descriptor in an
NSFileHandle
, which is XPC transportable.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"