watchOS 10, widgets, widget doesn't appear in the gallery

I am working on a new standalone Apple Watch app. However, I am unable to see my widget in the Smart Stack. My goal is to have a singular complication for the .accessoryRectangular family.

The latest beta I tried is Xcode Beta 8. I can't see the widget either on the Simulator or real hardware.

I have done these steps.

  1. Added Watch App target with DT set to 10.0. Bundle ID .watchkitapp
  2. Added widget extension target with DT set to watchOS 10. Bundle ID .watchkitapp.widget
  3. Added AppIntentTimelineProvider for the widgetExtension target, all based on the example code Backyard Birds: Building an app with SwiftData and widgets
  4. Added the Widget to the same target
@main
struct widget: Widget {
    let kind: String = "widget"

    var body: some WidgetConfiguration {
        AppIntentConfiguration(kind: kind, intent: ConfigurationAppIntent.self, provider: Provider()) { entry in
            widgetEntryView(entry: entry)
        }
    }
}

struct widgetEntryView : View {
    @Environment(\.widgetFamily) private var family

    var entry: Provider.Entry

    var body: some View {
        switch family {
        case .accessoryRectangular:
            RectangularView(entry: entry)
        default:
            Text("Not Supported")
        }
    }
}

What am I missing? In the past I would add the complications controller for the WatchKit, but I was hoping we don't need to do it.

I will research more into complications and WidgetKit for watchOS 10 and will keep this updated for people who struggling like me.

Answered by borisy in 763325022

I can see my widget now. I have not realised that I still have to provide bundle IDs for both targets. This wasn't obvious as during the creation of the project you already provided a bundle identifier. I have kept the default suffixes (1 and 2) and prepended the ID.

File `*.xcodeproj/project.pbxproj`
Key 1 `PRODUCT_BUNDLE_IDENTIFIER`
Key 2 `INFOPLIST_KEY_WKCompanionAppBundleIdentifier`

Calvin walks through how to configure your widget to appear in the gallery and Smart Stack in https://developer.apple.com/videos/play/wwdc2023/10029/?time=123

Accepted Answer

I can see my widget now. I have not realised that I still have to provide bundle IDs for both targets. This wasn't obvious as during the creation of the project you already provided a bundle identifier. I have kept the default suffixes (1 and 2) and prepended the ID.

File `*.xcodeproj/project.pbxproj`
Key 1 `PRODUCT_BUNDLE_IDENTIFIER`
Key 2 `INFOPLIST_KEY_WKCompanionAppBundleIdentifier`
watchOS 10, widgets, widget doesn't appear in the gallery
 
 
Q