I am trying to create an example of a simple application on XPCServices in which I do the following steps:
Step 1: Created a sample project and added a target - XPCServices named - HelperProcess to it. When the target is created, Xcode automatically generates the files below:
- HelperProcessProtocol.h
- HelperProcess.h
- HelperProcess.m
- main.m
Step 2: A main.m added to main.m in the ServiceDelegate implementation:
- (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection {
Step 3: In AppDelegate , the code below is added in applicationDidFinishLaunching:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
The problem is
When I launch the application, neither the log added to the listener: shouldAcceptNewConnection: is displayed or the assistant process appears in the Activity Monitor: (
Here is the code: XPCShootOut
Note: I am trying to do this on Xcode 6.0
Is there any additional tweak I need to make it work? Please suggest.
- Update -
I tried passing this sample from apple: AppSandboxLoginItemXPCDemo
When I tried to run it on Xcode 6, it displayed an error message - "Subscription ID not found". Since I do not have a registered mac developer account, in the build settings for iDecide and iDecideHelper, I changed "Code Signature Identification" to "Do not enter code."
I received a warning for each of the goals:
Code Sign warning: CODE_SIGN_ENTITLEMENTS specified without specifying CODE_SIGN_IDENTITY. It is not possible to add entitlements to a binary without signing it.
This time, when I compiled the assembly, it worked as expected.
Now I tried to follow the steps specified in the ReadMe.txt file, in particular, I followed these steps in my sample application:
Step 1: Updated - The main goal of the application β Features tab
- Application Sandbox Enabled
- Enabled Application Groups
- Added application group - "XYZ"
Step 2: Updated - Assistant Goal β Features tab
- Application Sandbox Enabled
- Enabled Outgoing Connections (Client)
- Enabled Application Groups
- Added application group - "XYZ"
Step 3: Updated - Target β General tab β Package Identifier, added the prefix "XYZ".
When the application was launched in the console, it displayed the following messages:
10/12/14 6:27:42.159 PM xpcd[554]: (null): Code identity[pid: 11875::Devarshi-Kulshreshtha.XPCShootOut (/Users/devarshi/Library/Developer/Xcode/DerivedData/XPCShootOut-aaedwraccpinnndivoaqkujcmhmj/Build/Products/Debug/XPCShootOut.app)] is not in ACL for container: ~/Library/Containers/Devarshi-Kulshreshtha.XPCShootOut/Data -- allowing access. 10/12/14 6:27:43.712 PM appleeventsd[63]: <rdar://problem/11489077> A sandboxed application with pid 11875, "XPCShootOut" checked in with appleeventsd, but its code signature could not be validated ( either because it was corrupt, or could not be read by appleeventsd ) and so it cannot receive AppleEvents targeted by name, bundle id, or signature. Error=ERROR:
None of the applications performed their intended function, and did not display the log message added to the delegate listener:shouldAcceptNewConnection:
I dont know. Please suggest if I missed something? Is it possible to get an example XPC service application without a registered Mac developer account?