3

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);      
    }
MagicFlow
  • 477
  • 3
  • 17
  • 2
    You've got a typo where you repeated `CLKComplicationFamilyCircularSmall` in the else if, so that path never gets executed. –  Jan 26 '16 at 06:24
  • thanks - yes just noticed that, and I will edit for completion sake only. I've just realised that the complication text by default is black!!!!! Go figure. So against a black backround...... solution was : template.tintColor = [UIColor whiteColor]; – MagicFlow Jan 26 '16 at 07:57

1 Answers1

0

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

Ken Ko
  • 1,517
  • 2
  • 15
  • 21
  • yes found that a full delete, and waiting a little while ensured the most current complications were being used. – MagicFlow Jun 01 '16 at 18:18