CLKComplicationWidgetMigrator not working

I'm trying to migrate from Complication with CLKComplication to WidgetKit.

I have implemented the required methods in https://developer.apple.com/documentation/widgetkit/converting-a-clockkit-app, but the migration is not working. There is no evidence that the method for migration is also called. It was the same with Xcode 14.0.1 and Xcode 14.1RC.

class ComplicationController: NSObject, CLKComplicationDataSource, CLKComplicationWidgetMigrator {
...
    @available(watchOS 9.0, *)
    var widgetMigrator: CLKComplicationWidgetMigrator {
        return self
    }

    @available(watchOS 9.0, *)
    func widgetConfiguration(from complicationDescriptor: CLKComplicationDescriptor) async -> CLKComplicationWidgetMigrationConfiguration? {
        return CLKComplicationStaticWidgetMigrationConfiguration(kind: "MyWidget", extensionBundleIdentifier: "com.example.myapp.mywatchkitapp.mywidget")
    }
}

What's wrong? Has anyone been able to migrate?

Post not yet marked as solved Up vote post of itok_sorakaze Down vote post of itok_sorakaze
1.5k views
  • Same. I implemented the Complication controller in the watch app, and set ClockKit Complication - Principal Class to $(PRODUCT_MODULE_NAME).ComplicationController in the app plist. It's never called.

  • I also have the same question. It seems the migration is never called.

  • I am facing same issue in latest beta as well. Does any one found the solution?

Add a Comment

Replies

MyWidget implementation is here

// bundle id="com.example.myapp.mywatchkitapp.mywidget"
@main
struct MyWidget: Widget {
    let kind: String = "MyWidget"

    var body: some WidgetConfiguration {
        StaticConfiguration(kind: kind, provider: Provider()) { entry in
            MyWidgetEntryView(entry: entry)
        }
        .configurationDisplayName("MyWidget")
        .supportedFamilies([.accessoryCircular, .accessoryRectangular, .accessoryInline, .accessoryCorner])
    }
}

I just wanted to add on that I have the same issue. The functions just never get called for me in a single target WKApplication Not sure if anyone happened to figure out the issue here? I can't see anything I might be missing in the documentation.

I faced the same issue today when migrating to watchOS 10 and widgetkit complications. What finally helped was to add supportedFamilies to WidgetConfiguration (the body parameter of the @main Widget struct)

@main
struct WatchWidget: Widget {
    let kind: String = "WatchWidget"

    var body: some WidgetConfiguration {
        StaticConfiguration(kind: kind, provider: Provider()) { entry in
            if #available(watchOS 10.0, *) {
                WatchWidgetEntryView(entry: entry)
                    .containerBackground(.fill.tertiary, for: .widget)
            } else {
                WatchWidgetEntryView(entry: entry)
                    .padding()
                    .background()
            }
        }
        .configurationDisplayName("WATCH-WIDGET")
        .description("WATCH-WIDGET")
        .supportedFamilies([.accessoryCorner, .accessoryCircular, .accessoryInline, .accessoryRectangular]) //<-- this
    }
}

Once this was done the migration started working!