Widgets showing a placeholder in Distribution releases, but on Debug they render correctly

Hi,

My setup:

  • XCode 14.2 (14C18)
  • 13.0.1 (22A400)

I'm adding Widgets to an already existing application that has been out for years. When building the application and using the Run scheme (uses Debug configuration), the widget renders correctly on the device.

Separately, when publishing the application on the AppStore, or when doing an AdHoc release, the widget does not render correctly.

The Widget Gallery renders correctly, but when on the home screen it displays a placeholder.

I've searched around for any similar issue and tested against a few devices. All are performing the same.

Below is a code snipped of a small widget. To confirm that the issue is not related to my entry, I've hard coded "Test". The issue still persists.

var body: some View
  {
      switch(size)
      {
          case .systemSmall:
              ZStack {
                  Color(hex: 0xF1D244)
                  GroupBox (
                      label: Label("Fast", systemImage: "fork.knife").font(.system(size: 18))
                  ) {
                  //Text(entry.fast)
                 Text("Test")
                     .foregroundColor(Color.black)
                    .font(Font.system(size:16, weight: .semibold, design: .default))
           
                  } // end GroupBox
                  .groupBoxStyle(OpacityGroupBoxStyle())      
              } // end ZStack
       ...
      <rest of switch statement>

It is not obvious to me what the issue is. I've come from Obj-C and Swift is still new for me.

Thank you!

Replies

I solved the issue. There was a bug where in some cases the app group was not populated correctly and this caused the widget to appear as a placeholder. Very funny bug and the logs and error logs showed no indication on what the issue was.

I hope this helps someone.