2
votes

I've written a complication for a Watch Face with Time Travel. However, i wanted the watchOS to "refresh" time line (like every hour) so that it will delete the current time line and then call getTimelineEntries again to obtain a new time line.

Is it possible? Thanks.

2

2 Answers

2
votes

As it is possible, to install more than one complication of your app in different slots of the current clock face, it would be better to call 'reloadTimelineForComplication:' for all active complications.

for (CLKComplication* complication in CLKComplicationServer.sharedInstance.activeComplications)
{
    //NSLog(@"Reloading Timeline for Complication: %@", complication);
    [CLKComplicationServer.sharedInstance reloadTimelineForComplication:complication];
}

From the docs: CLKComplicationServer.activeComplications: This property contains an array of CLKComplication objects, each of which represents a version of your complication currently displayed on the clock face. This array typically has no entries or only one entry, but it may have multiple entries if your complication is installed in more than one slot on the clock face.

1
votes

Whenever you want to refresh the the complication data, You can trigger refresh like this,

[[CLKComplicationServer sharedInstance] reloadTimelineForComplication:[[[CLKComplicationServer sharedInstance] activeComplications] firstObject]];

Fo reference you can check here