Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect and debug a custom ClockKit Complications controller?

I am trying get a custom ClockKit Complication working.

  1. I created a custom ComplicationController conforming to CLKComplicationDataSource. It’s added to the Watch Extension’s plist as CLKComplicationPrincipalClass.

I am able to select a complication on the watch and activate it but I only see "---------------" not my actual placeholder.

What I tried

  • I added custom override init(){…} to my ComplicationController and put a break point in it for debugging. But even when running the Complication build scheme this break point is never reached. It seems like my custom ComplicationController is never instantiated.

  • I do see a log message Extension received request to wake up for complication support. but it’s not clear to me where this is triggered in the code.

  • I also tried calling the following from my main InterfaceController to find out about my active complications

    if let server = CLKComplicationServer.sharedInstance() {
        for complication in server.activeComplications {
            server.reloadTimelineForComplication(complication)
        }
    }
    

    … but server returns nil. No complications appear to be active and reloaded.

Question

  • How do I successfully hook up my custom ComplicationController?

    Also any additional tips for debugging are welcome.

    Is it usually enough to remove the complications from the watch simulator or the watch app on the iPhone or do you need to re-install the whole watch app to see a complication related update in effect? Also, when I log something inside my custom ComplicationController, should I only see its output when running with the Complications build scheme or also with the normal Watch App build scheme?

Any ideas for finding the issue are welcome.

like image 871
Bernd Avatar asked Dec 05 '22 01:12

Bernd


1 Answers

Since you are actually able to select the complication on the watch, it sounds like everything project wise is setup correctly. Since its not hitting the breakpoint it sounds like the complication just can't find your custom controller. Since you are using swift you will need to specify the module of the controller. Try changing the CLKComplicationPrincipalClass value in your watch app's plist to:

$(PRODUCT_MODULE_NAME).ComplicationController
like image 179
lehn0058 Avatar answered Feb 09 '23 01:02

lehn0058