skip to Main Content

I have a SwiftUI iOS app that builds and runs perfectly on the Xcode Simulator. I’m trying to create a widget for my app. I create a new Widget Extension target successfully, and without modifying any of the stock template code, I try to run my extension target.

enter image description here

The widget extension builds successfully, and Xcode tells me the extension is running, but no widget appears in my simulator. I checked the "add widget" list and it isn’t there either.

I’ve tried making a widget without having the "Include Configuration Intent" checked, I’ve made sure that I’m running my app and widget extension on the same device (and I’ve tried different devices, iPhone 11, iPhone 12, etc.), I’ve tried uninstalling the app and rebuilding the project… I’m not sure what I’m missing here!

Any help would be greatly appreciated.

I’m on a late 2013 MacBook Pro, running MacOS Big Sur 11.5.2, and using XCode 12.5.1. I am not a paying Apple Developer member (if that makes a difference). I’m sorry if I’m leaving some important information out, I didn’t know what to include so please let me know if you have any questions.

Thanks so much for your help in advance!

2

Answers


  1. Chosen as BEST ANSWER

    Fixed! I did some poking and tried to run the preview canvas for my widget file, it gave me an error saying the preview couldn't be rendered.

    Googled it up, found this answer and rebuilt and ran the widget extension again. It still gave this error, so I rebooted the iPhone simulator and voila! It works!

    Thanks for the help, hope this helps someone down the road...


  2. Go to your mainTarget > Build Phases.
    Under Embed App Extensions, uncheck "Copy only when installing"

    The thing is, you want to see your widget getting copied over in all sessions, not just for the Production Profile.

    Build again and you should see your widget now.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search