XPC is the preferred inter-process communication (IPC) mechanism on Apple platforms. XPC has three APIs:
- The high-level
NSXPCConnectionAPI, for Objective-C and Swift - The low-level Swift API, introduced with macOS 14
- The low-level C API, which, while callable from all languages, works best with C-based languages
General:
- Forums subtopic: App & System Services > Processes & Concurrency
- Forums tag: XPC
- Creating XPC services documentation
NSXPCConnectionclass documentation- Low-level API documentation
- XPC has extensive man pages — For the low-level API, start with the
xpcman page; this is the original source for the XPC C API documentation and still contains titbits that you can’t find elsewhere. Also read thexpcservice.plistman page, which documents the property list format used by XPC services. - Daemons and Services Programming Guide archived documentation
- WWDC 2012 Session 241 Cocoa Interprocess Communication with XPC — This is no longer available from the Apple Developer website )-:
- Technote 2083 Daemons and Agents — It hasn’t been updated in… well… decades, but it’s still remarkably relevant.
- TN3113 Testing and Debugging XPC Code With an Anonymous Listener technote
- XPC and App-to-App Communication forums post
- Validating Signature Of XPC Process forums post
- This forums post summarises the options for bidirectional communication
- This forums post explains the meaning of the privileged flag
XPC is mostly used on macOS but there are a few places where it comes into play on iOS:
- File Provider extensions can export an XPC service to arbitrary apps. For more about the File Provider side of this, see the
NSFileProviderServiceSourceprotocol. For more about the client side, see theNSFileProviderServiceclass. - An app can move part of its code into a helper extension and talk to it using XPC. See Creating enhanced security helper extensions.
- Alternative browser engines can do a similar thing. See BrowserEngineKit for more about this.
- Apps with embedded extensions can use XPC via ExtensionFoundation. (Note that on iOS, but not macOS, an app can only use extensions embedded within the app itself.)
Related tags include:
- Inter-process communication, for other IPC mechanisms
- Service Management, for installing and uninstalling Service Management login items,
launchdagents, andlaunchddaemons
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"