Eric Wang
Eric Wang

Reputation: 21

How to create a Hello World XPC program?

I'm new to Apple XPC tech(actually I'm also new to Objective-C), recently I want to learn something about XPC technology, which is used to communicate between processes. Does anybody know how to combine a command line hello world program with an XPC program by using XCode? What I did is: 1) Create a command line 'HelloWorld' project; 2) Create a 'target' under the project 'HelloWorld' project; 3) Then I don't know how to combine them together; (maybe be set something in build setting?) If you can show me how to do this, it would be very helpful. Thanks.

My os is 10.12, xcode is 8.2.

Upvotes: 1

Views: 4388

Answers (1)

Prasanna
Prasanna

Reputation: 31

This link has some useful information about what you are looking for.

https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingXPCServices.html#//apple_ref/doc/uid/10000172i-SW6-SW1

Adding a XPC service target to your Xcode project should be the only thing you need to do, other than implementing the actual service.

The grunt work is taken care by Xcode itself. If you check the BuildPhase of your app, it will show that there is an Embedded service section which will take care of copying your XPC service output to your build output dir.

Once things compile, you ll find your XPC service is #build/(Debug || Release)//XpcServices

Upvotes: 0

Related Questions