Apple Clockkit Complication do not display placeholder data

1.4k views Asked by At

I'm developing some clockkit complications in objective-c using ios 9.2 and xcode 7.2

I've watched a great video here https://developer.apple.com/videos/play/wwdc2015-209/ and found a couple of helpful articles. In this video, and also in the articles, it is stated that the following code in the Complications Controller is all that is needed for static / placeholder complications.

Has something changed, or am I missing something more fundamental here? With the following code in place, I can see my complication for selection, however it is blank / null.

Any ideas? I could go on to implement the other delegates, however was hoping to achieve this step first.

- (void)getPlaceholderTemplateForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTemplate * __nullable complicationTemplate))handler {

    if (complication.family == CLKComplicationFamilyCircularSmall){

      CLKComplicationTemplateCircularSmallRingText *tmpl = [[CLKComplicationTemplateCircularSmallRingText alloc] init];

      tmpl.textProvider = [CLKSimpleTextProvider textProviderWithText:@"Title Text"];
      tmpl.fillFraction = 0.07f;
      tmpl.ringStyle = CLKComplicationRingStyleClosed;

      handler(tmpl);
    } else if  (complication.family == CLKComplicationFamilyModularLarge){

      CLKComplicationTemplateModularLargeStandardBody *template =   [[CLKComplicationTemplateModularLargeStandardBody alloc] init];
      template.headerTextProvider = [CLKSimpleTextProvider textProviderWithText:@"Title Text"];
      template.body1TextProvider = [CLKSimpleTextProvider textProviderWithText:@"Body Text"];
      handler(template);      
    }
1

There are 1 answers

1
Ken Ko On

This is what happened to me...

It seemed that my complication didn't get reinstalled properly on the simulator. It was still picking up an older version which was not implemented properly and was blank. Doing a simulator reset, then reinstalling my watch app, that did the trick. I find whenever the template change, I need to reset the simulator, otherwise it doesn't show up. I'm using Xcode 7.3, targeting WatchOS 2.2