I was able to set up my Xcode Source Editor Extension to work with XPC.
When I run the app via Xcode for debugging purposes, everything works. My XPC extension is lauched.
I then Archived and distribute the project (for Development). After installing the extension and invoke a command, the XPC service never launches. I don't see it in Activity Monitor.
Additionally, the Xcode extension just shows the error:
The command "Foo" is still busy.
Why would it be opening the XPC service correctly in debug mode, but when I distribute the app, it fails to launch the XPC service?
My XPC extension (and app) depends on a shared framework I created. Not sure if that is related to the problem.
The best way to debug this is not necessarily by looking at the Console messages, but rather looking at the Crash Reports in the Console app. When I went there, I noticed that the XPC service was crashing every time it was run.
The crash was:
This made me realize I should double check the settings I used when upgrading from Objective-C XPC to Swift XPC. In particular, the part I was confused about was when the article said to set
Runtime Search Paths: @loader_path/../../../../Frameworks
. Turns out it should be added, not removed from the list.I switched the XPC's Runpath Search Paths from:
to
And the XPC service no longer crashes.