Got Another update. Decided to rewrite the widget from scratch and I can now get data to the widget to display, only I now have another problem in that my custom fonts that I use in the widget are not being used and also the background image that I have for the whole widget is not being displayed at all.
Post
Replies
Boosts
Views
Activity
Quick update. In the other apps I’ve written that use exactly the same process to update their widgets, they are updating. They only have a Lock Screen widget and not normal ones. I’m not sure if that difference is enough to cause it not to update at all.
I use a specific suiteName to send the data through UserDefaults, with my own key.
private func sendWeatherDataToWidget(input: CurrentDataConverted) {
let widgetData: WidgetWeatherData = WidgetWeatherData(theTemp: input.currentTemp,
theMax: input.dailyMaxTemp,
theMin: input.dailyMinTemp,
theTime: input.time,
theTempUnits: input.temperatureUnits,
theLocation: input.location)
let tempData = try! JSONEncoder().encode(widgetData)
UserDefaults(suiteName: "group.com.emkubed.Weewx-Weather")!.set(tempData,forKey: "Weewx-Weather")
WidgetCenter.shared.reloadTimelines(ofKind: "com.emkubed.Weewx-Weather")
logger.debug("Sent data to Widget - hopefully")
}