ClockKit Complications not working with Xcode 14 single-target watchOS app

I’ve created a single-target watchOS app in Xcode 14, but I can’t seem to get ClockKit complications working.

I’ve added a CLKComplicationDataSource class to my watch target, and in the Info pane for my target I have set the CLKComplicationPrincipalClass key to MODULE-NAME.ComplicationController

I haven’t yet added Complication placeholder images to my Assets.xcassets, but as far as I am aware, that shouldn’t be a problem while I am still testing.

However, when I run it on a watchOS simulator, the complications never show up on the watch complications list when adding a complication.

All of the tutorials I can find for ClockKit complications reference older two-target WatchKit apps. Do the newer single target apps no longer support ClockKit? If so, how can I make a two-target WatchKit app with Xcode 14?

Unfortunately I cannot use WidgetKit for my complications because I need to support watchOS 7 at least, and WidgetKit only supports watchOS 9+

Thanks for your help

Post not yet marked as solved Up vote post of AlwardK Down vote post of AlwardK
1.4k views
  • I have the same question , are you resolved your question,please help me with demo

Add a Comment

Replies

We are having ClockKIt issues with single target watch app. Would be interested in knowing as well does apple support ClockKit on single target watch apps.

If you are still looking to a solution to this problem - or for anyone else who needs CLKComplications for watchOS 7 and 8 and to also have WidgetKit complications for watchOS9+ in the same app, the key to getting CLKComplications working on a single target watch app is to implement the getComplicationDescriptors(handler:) method in your ComplicationController class. In this method you need to specify the complications your app supports. If you don't do this, the complications won't show up at all, even if you specified supported complication families in the info.plist file. In fact, you need to delete the CLKComplicationSupportedFamilies key from the info.plist once you implement the new method in the ComplicationController class. Note that if you are adding WidgetKit support for complications into an older app, you will want to migrate your two-part app into a single target, which means that a minimum target will be watchOS 7 (which will bring with it this CLKComplications problem). If you don't migrate to a single target app, the WidgetKit complications will not update reliably at all.