Hi, my name’s Jeff and I’m writing from Calgary, Alberta. I used to be a programmer, and now I’m a nursing student. I’m also a member of Cochrane Search and Rescue.


2 thoughts on “About

  1. Hello Jeff, I’ve bumped into your GitHub account was wondering if I can ask you something regarding one of your projects named SampleOSXLaunchDaemon.

    I’ve took this project as a reference to my own project which contains system wide Daemon based on mixed c++/objective-c code operated by launchd according the plist file with the proper configuration reside in /Library/LaunchDaemons/. The server side is UI based application (built by storyboard) which runs from the background and defined as LaunchAgent.
    Now I wish to establish a connection between them so that the Daemon can send messages to be displayed by the UI application. the messages can contain strings/numbers or any other displayable data, with option that the UI may send back reply.

    Following your example, I’ve tried using XPC connection and added NSXPCConnection to my daemon that shares a dedicated protocol with the server implemented in the UI side using NSXPCListener.

    When trying to change the process type where the XPC server/listener resides from LaunchDaemon to LaunchAgent, the connection hasn’t succeed.

    Perhaps you can help me with the following issues:

    1. Should I implement the UI as launchAgent (I need to support multi-users, meaning that the daemon can send different messages to each UI instance per user)

    2. Should I consider using dedicated `XPC service`. Seems like Xcode has option to create XPC service, but I don’t know how should I “attach” the UI code inside …

    3. Is it possible to have XPC client which runs objective-c code while the XPC listener will run on swift code ?

    thanks for your help !

    Liked by 1 person

    • Hi Irad,

      Sorry for the delay in getting back to you here. I have a few comments before I get into your questions.

      Firstly, it’s important to note that anything the daemon sends out is a notification, while anything that gets sent to the daemon is a request. The client may get a notification and then send a request in response, but its still a request.

      Secondly, the XPC server/listener needs to remain inside the daemon, so its understandable you’re running into issues when you’re trying to move it into your agent. Now onto your questions.

      1. Implementing your UI as an agent is totally reasonable, but you could also implement it as an app, up to you and what you want to achieve.

      2. My sample project is an example of a dedicated XPC service. Its important to remember that the daemon, and thus the XPC server, does not reside in user-space, so you can’t have a UI as part of the same program. A different user-space program will implement a UI, and then communicate with the daemon via XPC.

      3. Generally there isn’t an issue mixing Swift and ObjC code in the same project, however it will come down to the API you’re working with. If its implemented completely and correctly for both Swift and ObjC, then there shouldn’t be any issues, however this isn’t always the case.

      Hope this helps!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s