Changes to widgetKit code not reflected in Simulator

My widget seems stuck in time. Regardless of what changes I make to the widget, they are not reflected in the simulator. Further, I've placed a breakpoint in getTimeline(in, completion) and it isn't getting called.

Any ideas?

Replies

Double check that you don't have an earlier copy of your app with an embedded version of your Widget Extension, in the /Applications folder. It looks like when your app runs for the first time and grabs the Widget Extension for it (as is expected macOS behaviour), it actually checks the /Applications folder for the Widget Extension first, instead of grabbing the running version which triggered it.

If you do have an app in /Applications, delete it, Empty Trash, and reboot (in case it's already loaded).

I've been pulling my hair out for two days trying to work this out, trying all the suggestions on the web, such as deleting all the Widget Simulator data, deleting the /Library and ~/Library widget Containers, rebooting all the time etc.

What lead me to this is my Widget Extension name in Activity Monitor once activated -- I'd just changed it in Xcode so it was more obvious in debugging and noticed the name in Activity Monitor hadn't actually changed, even though the running build clearly had the new name in it's package.

I hope this helps.