strangetimes
strangetimes

Reputation: 5213

Today Widget on OS X not working

I can't seem to get my Today widget (or any extension for that matter) running in the Widget Simulator. The simulator launches and says "Couldn't Open Widget" along with

Failed to find Widget /Users/SomeUser/Library/Developer/Xcode/DerivedData/Build/Products/Debug/MyApp.app/Contents/PlugIns/MyApp.appex

I looked in Console app and I see this as well:

pkd[299]: ignoring mis-configured plug-in at /Users/SomeUser/Library/Developer/Xcode/DerivedData/Build/Products/Debug/MyApp.app/Contents/PlugIns/MyApp.appex: plug-ins must be sandboxed

But it is sandboxed in xcode! It's codesigned, sandboxed and the lot. Even if I try and deploy it on a new machine (registered as a developer machine with my developer provisioning profile), the widgets don't even show up in System Preferences.

Any idea what I need to do?

Upvotes: 9

Views: 1626

Answers (3)

David Seek
David Seek

Reputation: 17132

Based on strangetimes's answer here a little more detailed answer:

First select your project and then your App Target (not the extension)

enter image description here

Then click on Build Phases, then on the top navigation on Editor, here select first Add Build Phase and lastly click on Add Copy Files Build Phase.

enter image description here

That's it. Build again using the Widget Simulator and it should work now.

Upvotes: 0

Dmitry Isaev
Dmitry Isaev

Reputation: 3998

I couldn't stop building & codesigning by hand, so I looked into Xcode build logs and found the difference :) in my case, I just added -fapplication-extension to compiler & linker flags, now it works!

Upvotes: 0

strangetimes
strangetimes

Reputation: 5213

Okay finally found the problem. I was codesigning my app by hand (which had never been a problem before) since I had an intricate set of frameworks the app relied upon, and needed to hand copy them using a Copy / Runscript post-build script. Any way, it seems starting Xcode 7 at least, this no longer works as expected. The app works and codesign says the app has been signed correctly, but clearly something is happening behind the scenes that's breaking the codesignature. I ended up removing all my manual codesigning stuff and simply using Xcode's 'Copy Framework' post build step and checked 'Sign on Copy'. It's now finally working as expected.

Upvotes: 7

Related Questions