Can Safari app extension communicate with XPC service

Is it possible to open a communication channel from Safari app extension to XPC service on MAC?


I created Xcode project with Safari app extension and XPC service targets

I am setting up a connection to the XPC service from extension's message handler "messageReceivedWithName" using NSXPCConnection and got the below error.


Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named mySafariAppExtn1.XPCService was invalidated."


In the extension entitlements, added below keys

com.apple.security.network.client

com.apple.security.network.server

com.apple.security.temporary-exception.mach-lookup.global-name


Is there any other IPC mechanism by which I can do the same

Thanks

Replies

This is something that I would expect to work.


If it's something you are continuing to run into issues with - the best way forward would be to file a bug at https://bugreport.apple.com with a sample project showing the issue.

As far as I know the app extensions are sandboxed. You could setup a group container and do some IPC via files using NSFileCordinator but those APIs are a developer's dream come true :-)


I know sure how much of FS APIs one could use. Also not really sure what Apple will complain about when we submit the app.

It does work, but there are some catches. Check please https://forums.developer.apple.com/thread/62932#336917