Posts

Post not yet marked as solved
0 Replies
613 Views
Hello, I have developed an app that has a Widget that is updated daily at the user's midnight. The timeline will provide 3 entries, with a policy .atEnd: Yesterday (today's midnight minus one day) Today (today's midnight) Tomorrow (today's midnight plus one day) This app has been live for a few months and has a substantial install base. We consistently get emails from users a couple of times a week, mentioning the Widget is "stuck" at a previous date. I was able to reproduce the issue locally at a couple of devices that I installed the app, added the widget to the home screen and left it running for a few days. I would then check the home screen after a while and the problem would manifest itself in different ways: Sometimes only parts of the SwiftUI view would be refreshed: the label that shows the date would be incorrect, but a different label was refreshed correctly Sometimes the widget will actually be stuck, showing an entry from 3 days ago If I have two instances of the widget with different sizes on the same home screen, one of them can be stuck at a past date and another only partially refreshed The widget uses a different gradient background color each day. That usually (always?) is current. Sometimes they will work fine for 2-3 days and then start "lagging" I've then added some logging to a text file that will output the Timeline object and the SwiftUI view that was returned to WidgetKit. After the issue happened again, I can confirm: The timeline is being refreshed correctly, has the correct dates and correct TimelineEntry objects. The SwiftUI view returned to WidgetKit contains all the labels with the correct text and formatted correctly (I did a simple dump of the view like print("\(view)")) So the only possible culprit left would be Springboard failing to render the SwiftUI view for the Widget, somehow. If I go into the devices settings and flip the clock toggle between 12/24 hours, this forces Springboard to refresh the widget and they immediately refresh to the correct view state. Is this a known issue? Are there any possible workarounds to force WidgetKit always render the widget correctly? Thanks in advance!
Posted
by leolobato.
Last updated
.