Search code examples
macospy2appfindersync

How to bundle FinderSync Extension in an App built using py2app


I'm trying to add a FinderSync Extension in an App which is built using py2app.

py2app does not have a recipe for bundling App Extensions so I created a Cocoa project and added a FinderSync Extension target. After building the appex I copied the appex to the app built using py2app under Plugins folder.

The FinderSync Extension is set to be sandboxed using entitlement file but when I launch the main app I got following message displayed on Console App.

9/17/15 10:33:50.212 AM pkd[309]: ignoring mis-configured plug-in at /Applications/Test.app/Contents/Plugins/TestFinderSync.appex: plug-ins must be sandboxed

I've searched on Stack Overflow but could not find the solution.

What am I missing here?


Solution

  • In order to make it work You should provide the entitlements file from your plugin.

    MyPlugin.entitlements

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>com.apple.security.app-sandbox</key>
        <true/>
    </dict>
    </plist>
    

    And codesign the plugin with the your cert:

    codesign --sign <cert> --entitlements <path to entitlements file> --force <path to bundle>/Contents/PlugIns/MyPlugin.appex
    

    Also, if You are building the plugin from Swift source, make sure bundle up all required Swift*dylibs in Contents/Frameworks

    Hope this helps