My widget updates fine at iOS 14.x but it is not updating on iOS 15. If I install my app on a iOS15 device, the widget updates once directly after installation, but than the timeline is not executed anymore. The same widget works perfectly at iOS 14.x and updates every 15 minutes as designed. Even WidgetCenter.shared.reloadAllTimelines() is not working from the main app. Can someone help? Is there any necessary change for iOS 15 that I have missed?
here is the code:
func getTimeline(in context: Context, completion: @escaping (Timeline<SolarEntry>) -> ()) {
var entries: [SolarEntry] = []
Loadinggroup.enter()
InitLoadData()
Loadinggroup.notify(queue: .main) {
// Generate a timeline updating every 15 min, starting from the current date.
let currentDate = Date()
// refresh every 15 min:
let entryDate = Calendar.current.date(byAdding: .minute, value: 15, to: currentDate)!
let entry = SolarEntry(date: entryDate, solarout:solaroutString, gridout:gridoutString, acpower: acpowerString, batpower: batpowerString, batstate: batstateString, lastupdate: lastupdateString)
entries.append(entry)
// }
let timeline = Timeline(entries: entries, policy: .atEnd)
completion(timeline)
}
}