Cripto
Cripto

Reputation: 3751

XPC Service NSCocoaError domain

I've written an Application that uses XPC Service to communicate with its helper. The application launches and works as expected within Xcode.

However, the following error appears when I try to run the application outside of Xcode after I Archive it.

HideMyMac[27183:936477] XPCService error: Error
Domain=NSCocoaErrorDomain Code=4097 "connection to service named 
io.jabbari.HideMyMac.HideMyMac-XPCService" UserInfo=
{NSDebugDescription=connection to service named  
io.jabbari.HideMyMac.HideMyMac-XPCService}

Here is the source of this application on Github. I normally would provide source with my code, however, the xml style plists would clutter the page and take away from the post.

Here what I have attempted:

Step 1: Updated - Main App Target -> Capabilities Tab

Step 2: Updated - Helper Target -> Capabilities Tab

What am I missing anything?

Upvotes: 4

Views: 1471

Answers (1)

IngmarStein
IngmarStein

Reputation: 668

This is probably not a good question for StackOverflow, because it's a very project-specific configuration issue.

The actual problem you're running into is that the XPCService crashes immediately:

HideMyMac[5999]: XPCService error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named io.jabbari.HideMyMac-XPCService" UserInfo={NSDebugDescription=connection to service named io.jabbari.HideMyMac-XPCService}
ReportCrash[5995]: Saved crash report for HideMyMac-XPCService[6000] version ??? to …

this is because the SMJobKit framework cannot be found by the dynamic loader at the expected place:

Dyld Error Message:
Library not loaded: @rpath/SMJobKit.framework/Versions/A/SMJobKit
Referenced from: /Users/USER/Library/Developer/Xcode/Archives/2016-02-24/HideMyMac 24.02.16, 16.32.xcarchive/Products/Applications/HideMyMac.app/Contents/XPCServices/HideMyMac-XPCService.xpc/Contents/MacOS/HideMyMac-XPCService
Reason: image not found

So, you should check the copy files / embed framework phases in Xcode's build phases tab.

Upvotes: 4

Related Questions