chepiok
chepiok

Reputation: 245

iOS widget always displaying placeholder on simulator or device

I'm made an very basic iOS Widget Extension with (on iOS 16):

struct TotoView: View 
    var body: some View {
        VStack {
            Text("Toto")
                .font(.headline)
        }
    }
} 

struct TotoWidget: Widget {
    var body: some WidgetConfiguration {
        IntentConfiguration(kind: "myKind", intent: ViewTodayIntent.self, provider: TimelineProvider()) { entry in
        TotoView(entry: entry)
    }
    .configurationDisplayName("Today work")
    .description("Show today work sessions")
    .supportedFamilies([.systemSmall, .systemMedium])
    }
}

On the SwiftUI Canvas preview, I can see the "Toto" text.

In SwiftUI Canvas

BUT when I select the Widget Target and run in the simulator, I only have the placeholder in place of text. Any idea of why? Note that not only the text is replaced by placegholder but also an Image(systemName:)

I think the issue seems to be related by IntentConfiguration (as everything works fine with StaticConfiguration)

I'm on xCode 14.

In simulator

Upvotes: 6

Views: 1066

Answers (1)

Tobi
Tobi

Reputation: 31

In my Case it helped to change the Simulator. The Bug is still in my case on an iPhone 11 Simulator and on a real iPhone 11.

With other Simulators it works well.

Maybe its an issue with an iPhone 11.

Upvotes: 3

Related Questions