XPC Service not launching from Xcode Source Editor Extension (`still busy`)

321 views Asked by At

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.

1

There are 1 answers

0
Senseful On

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:

Termination Reason:    DYLD, [0x1] Library missing

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:

$(inherited)
@loader_path/../../../../Frameworks

to

$(inherited)
@executable_path/../Frameworks
@loader_path/../Frameworks
@loader_path/../../../../Frameworks

And the XPC service no longer crashes.