Pages

Friday, April 12, 2013

Can you run an XPC service inside a plugin? (e.g. a Print Dialog Extension plugin)

I am creating a Print Dialog Extension (PDE) plugin. This plugin is called and displayed when a user Prints from different apps, e.g. TextEdit, Preview, Xcode, etc. Note that the plugin runs on top of the app that called the Print Plugin (for example, TextEdit).

Inside the plugin, I need to run an XPC service. I need an XPC service since the entitlements on the main app might not be sufficient for my needs, e.g. I need to connect to the network, and TextEdit does not have the required entitlements for network connection.

The problem is, I can't create an XPC connection. The handler always fire with XPC_ERROR_CONNECTION_INVALID.

1.) Is this because the PDE Plugin is not inside the main bundle/main app, e.g. Text Edit?
2.) If yes, how can I still run an XPC service within a PDE Plugin?
3.) If no, then why can't I successfully create an XPC connection?


View the original article here

0 comments:

Post a Comment