I finally managed to make it working.
The thing is initWithMachServiceName must be called with: from the app: the full path of the login item bundle, i.e. /Applications/myApp.app/Contents/Library/LoginItems/a.b.c.d.e.LoginItemAgent.app
from the FinderSync ext: the bundle id of the login item, i.e. a.b.c.d.e.LoginItemAgent
Post
Replies
Boosts
Views
Activity
So, I've been able to set my bundle id starting with a figure from the Build Settings tab...
Now my app can communicate with the login item agent, but the FinderSync, still not...
I found this error in the Console:
Sandbox: Extension(7145) deny(1) file-read-data .....myApp.app/Contents/Library/LoginItems/a.b.c.d.e.LoginItemAgent.app
The app, FinderSync ext and login item agent are all in the same App Group, sandboxed and signed with "Apple Development" (debuging in XCode).
Any idea?
Ok, thank you.
So I'm trying to make working the AppLoginItemXPCDemo example.
In the readme, I found that "The bundle identifier of a login item must start with your Team ID", but my Team ID starts with a figure and this is not accepted by XCode.
Is there a solution?
I have also tried without success to set com.apple.security.temporary-exception.mach-register.global-name/com.apple.security.temporary-exception.mach-lookup.global-name entitlements.
In myApp.entitlements:
...
keycom.apple.security.temporary-exception.mach-register.global-name/key
array
stringa.b.c.d.e.f/string
/array
And in Extension.entitlements:
...
keycom.apple.security.temporary-exception.mach-lookup.global-name/key
array
stringa.b.c.d.e.f/string
/array
Should I use an XPC login item app between the app and the extension?
myApp = XPC login item app = FinderSync ext
By dint of searching, I came across the AppLoginItemXPCDemo example, but it dates from 2012 ... No better solution has been proposed by Apple since? It seems like it's a common problem to get an application to communicate with a FinderSync extension ...
Finally, I managed to make it work, I did not understand that the sys ext had to be the listener.
Thank you for your help.
It's really solved this time!
Not solved, but I cannot remove the "Solved" badge I set by mistake...
If you add an XPC Service to an app then the service is registered in the app’s namespace. Only that app can access it.
So, what should I do to communicate between my app and my sys ext?
Hello!
So, I have added an XPC service to my application.
I'm able to communicate between the app and the service but still not between the system extension and the service.
The code is almost the same for the app and the system extension The only difference is:
_xpcConnection = [[NSXPCConnection alloc] initWithServiceName:_serviceName]; // App code
_xpcConnection = [[NSXPCConnection alloc] initWithMachServiceName:_serviceName options:0]; // Sys ext code
The interruptionHandler and invalidationHandler don't catch any error.
I don't see any error in the Console.
The service and sys ext belong to the same app group.
I have added NSEndpointSecurityMachServiceName to the Info.plist of the sys ext.
I have also tried to add it to the Info.plist of the service (not sure it's usefull or not).
"sudo launchctl procinfo ... " for the service:
endpoints = {
"a.b.c.d.e" = {
port = 0x105c77
active = 1
managed = 1
reset = 0
hide = 0
}
}
"sudo launchctl procinfo ... " for the sys ext:
endpoints = {
"a.b.c.d.e" = {
port = 0xf5d5b
active = 0
managed = 1
reset = 0
hide = 0
}
}
How can I debug that?
Thank you.
Thank you for your answer.
Yikes! You’re using Distributed Objects (DO). Don’t do that. It’s been deprecated for a while now and for good reason. It’s deeply broken.
It's an old app and I didn't want to rewrite everything (now). The migration is not trivial...
The standard way to set up comms between an app and an ES sysex is via NSEndpointSecurityMachServiceName.
Ok, I will try to get by using this.