(This seems to have been encountered by others in previous weeks, but there were no solutions I found.)
I'm trying to do a really basic thing: Get data from my iOS application or my Watch application into my Complication controller.
I find myself less able to achieve this than I thought. The WatchOS 2 Transition Guide indicates that I should "[extract] the necessary data from the extension delegate" using the following code:
ExtensionDelegate* myDelegate = [[WKExtension sharedExtension] delegate]; NSDictionary* data = [myDelegate.myComplicationData objectForKey:ComplicationCurrentEntry];
Great. Also, I was not able to figure out how to make this work on the extension side. Although, more importantly, I can't even get the extension delegation code to work at all from running the complexity controller. When I run the complexity, I get this message: "Request to add to wake up to support complications." However, none of the codes inside any of the delegate extension methods seem to run. I also set breakpoints in each method, and none of these breakpoints hit.
It also looks like this: "transferCurrentComplicationUserInfo:" is also suggested for use to update complications, although it is unclear exactly how it is used. As I understand it, he used the extension wakeup so that ExtensionDelegate could store new data the next time the complexity controller starts, but due to a previous problem, I could not confirm.
I have one workaround (ping the server from the complexity controller and hope that the session variables are saved, so I can send the corresponding data), but there is every chance that if I can not handle this, then my work on complication will be thrilled. Any help here would be great.
By the way, here is the code I have for "getCurrentTimelineEntryForComplication", if at all useful.
- (void)getCurrentTimelineEntryForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimelineEntry * __nullable))handler { NSDate* entryDate = [NSDate date]; ExtensionDelegate* myDelegate = [[WKExtension sharedExtension] delegate]; NSString* data = [myDelegate.complicationData objectForKey:@"meow"]; NSLog(@"complication data: %@", data); CLKComplicationTimelineEntry* entry = [self getTimelineEntry:@"2015-08-25 00:19:42" entryDate:entryDate complication:complication]; handler(entry); }