Re: XPCService not getting launched from app
Re: XPCService not getting launched from app
- Subject: Re: XPCService not getting launched from app
- From: Devarshi Kulshreshtha <email@hidden>
- Date: Sun, 12 Oct 2014 18:40:39 +0530
I tried to refer 'AppSandboxLoginItemXPCDemo' sample from apple:
https://developer.apple.com/library/mac/samplecode/AppSandboxLoginItemXPCDemo/Introduction/Intro.html#//apple_ref/doc/uid/DTS40012292-Intro-DontLinkElementID_2"]AppSandboxLoginItemXPCDemo
When I tried to run it on XCode 6, it displayed error message - 'No
signing identity found'. Since I don't have registered mac developer
account, in build settings for - iDecide and iDecideHelper I changed
'Code Signing Identity' as 'Don't Code Sign'.
I got a warning for each of the targets:
'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 build, it worked as expected.
Now I tried to follow the steps specified in its ReadMe.txt file,
specifically I performed these steps in my sample app:
Step 1: Updated - Main App Target -> Capabilities Tab
a. Turned on 'App Sandbox'
b. Turned on 'App Groups'
c. Added an app group - 'XYZ'
Step 2: Updated - Helper Target -> Capabilities Tab
a. Turned on 'App Sandbox'
b. Enabled 'Outgoing Connections (Client)'
c. Turned on 'App Groups'
d. Added an app group - 'XYZ'
Step 3: Updated - Helper Target -> General Tab -> Bundle Identifier,
added 'XYZ' prefix to it.
On running the app in console it displayed these 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: #100013 {
"NSDescription"="SecCodeCopySigningInformation() returned 100013, -."
} (handleMessage()/appleEventsD.cp #2072) client-reqs-q
Neither app performed its intended function nor it displayed the log
message added in 'listener:shouldAcceptNewConnection:' delegate.
I am clueless. Kindly suggest if I am missing any thing? Is it
possible to get XPC service sample app working without a registered
mac developer account?
On Fri, Oct 10, 2014 at 11:23 AM, Devarshi Kulshreshtha
<email@hidden> wrote:
> I am trying a simple sample app on XPCServices, in which I am
> following below steps:
>
> Step 1: Created a sample project and added target - XPCServices with
> name - HelperProcess to it. When the target is created XCode
> automatically generates below files:
>
> 1. HelperProcessProtocol.h
> 2. HelperProcess.h
> 3. HelperProcess.m
> 4. main.m
>
> Step 2: In main.m added a log statement within implementation of
> ServiceDelegate:
>
> - (BOOL)listener:(NSXPCListener *)listener
> shouldAcceptNewConnection:(NSXPCConnection *)newConnection {
> // This method is where the NSXPCListener configures, accepts,
> and resumes a new incoming NSXPCConnection.
> NSLog(@"Log which is never displayed :(");
> // Configure the connection.
> // First, set the interface that the exported object implements.
> newConnection.exportedInterface = [NSXPCInterface
> interfaceWithProtocol:@protocol(HelperProcessProtocol)];
>
> // Next, set the object that the connection exports. All
> messages sent on the connection to this service will be sent to the
> exported object to handle. The connection retains the exported object.
> HelperProcess *exportedObject = [HelperProcess new];
> newConnection.exportedObject = exportedObject;
>
> // Resuming the connection allows the system to deliver more
> incoming messages.
> [newConnection resume];
>
> // Returning YES from this method tells the system that you
> have accepted this connection. If you want to reject the connection
> for some reason, call -invalidate on the connection and return NO.
> return YES;
> }
>
> Step 3: In AppDelegate added below code in applicationDidFinishLaunching:
>
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
> // Insert code here to initialize your application
>
> _connectionToService = [[NSXPCConnection alloc]
> initWithServiceName:@"HelperProcess"];
> _connectionToService.remoteObjectInterface = [NSXPCInterface
> interfaceWithProtocol:@protocol(HelperProcessProtocol)];
> [_connectionToService resume];
> }
>
> Problem is -
>
> When I launch the app, neither the log added in
> listener:shouldAcceptNewConnection: is displayed nor the helper
> process appears in Activity Monitor :(
>
> Here is the code: https://github.com/Daemon-Devarshi/XPCShootOut
>
> Note: I am trying this on XCode 6.0
>
> Is there any additional setup which I need to do to make it working?
> Please suggest.
>
> --
> Thanks,
> Devarshi
--
Thanks,
Devarshi
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden