2

I have an app, that is a container app for a Share App Extension and an XPC Service. The XPC Service creates a NSUserNotification and delivers it to the NSUserNotificationCenter.

If I connect to the XPC Service from within the container app, I can make calls to it successfully.

If I attempt to connect to the XPC Service from within the extension, it does nothing.

My goal with this is to display a user notification after the share extension completes. Share extensions can't create user notifications themselves, but I can't seem to get the XPC calls to work either.

Leigh McCulloch
  • 1,886
  • 24
  • 23

1 Answers1

1

In the Share App Extension target, make sure to create Copy Files Phase and select a Destination of XCP Services. Hit the + button at the bottom and select the XPC build result from the Products section.

There is an example project and a blog article where they connect to xpc through an extension: https://www.objc.io/issues/14-mac/xpc/#debugging

joels
  • 7,249
  • 11
  • 53
  • 94
  • This did the trick for me. Once you create the XPC Service as an extension for the host app you can use it as well for other extensions by using your steps. – Burcea Bogdan Madalin Oct 02 '19 at 15:03