iOS 14 widgets: Content update frequency and latency limits and best practices

With regards to the new iOS 14 widgets implemented with WidgetKit:

For a widget that needs to have frequent, unpredictable pushes of content, I'm curious to how often data can be pushed to the widget and how quickly the widget will reflect this updated data.

Specifically,
  1. Is there a maximum number of reloads per day? Is there a throttle to how often we can reload?

  2. Is there an upper limit to the time taken between the call to reloadTimeline() and when the reload actually happens?

3a. If events are unpredictable, should we use a timeline at all? (as compared to just a single entry in the timeline at all times) Or should there just be a very finely grained timeline (eg. every minute) that simply does pull requests in the background to see if anything changes?

3b. Or should everything be based on push notifications which reloads the timeline? What if the user has disabled push notifications?

For example, a news widget might want to keep the user updated of breaking news which might be relevant only for the next 10 minutes. (eg. "Soccer: Chelsea-Liverpool 3-1 upset at half time!")

I am curious how the Apple stock widget is implemented as well. Does it have a 1 minute interval timeline, and each entry attempts to update the content via a background network request?

As WidgetKit is really new to us, I would appreciate any guidance from Apple regarding the best technical designs and practices in this area.

Thanks so much!

Replies

Good questions. Did you ever get any answers to this?
I figured that I could look into the console (specifically, the macOS console app that displays my connected iPhone's logs), and I found a message describing a "budget" allocated to the timeline being decremented. I'm not sure how to interpret the budget object this log describes, but I think you might get an idea of how often the budget is decremented.

default 22:57:35.720663-0400 dasd Decremented widget refresh budget for <private> by 0.250000, budget is now <_DASWidgetBudget <redacted by me>::medium::1160724381304447037::{329.0-155.0}::21.6: 56.50/ 75.00>

I think we need these questions to be answered. It’s surprising how opaque Apple seem to be about this topic. My reading online suggests every 15 minutes is optimum but in the absence of proper documentation it’s hard to know. So , Apple support if you are reading this , please provide your developers more information on this topic. Thank you.
I would also really love an answer to this question.
➕1️⃣
I would like to have transparent rules on how frequently iOS 14 widget may be updated as well.
I don't have any definitive answers here, but I can answer one of your questions: Always use multiple timeline entries if the exact timing of when a widget shows up is important. When you refresh your widget, if you add a timeline entry for a given date/time it will show up within a second or two of that time. On the other hand, the system can be very unpredictable about when it will activate your extension to run your reload logic. My suggestion is to generate timeline entries well past the time when you want to refresh with your best guess as to what it should look like then, and let those get replaced whenever your timeline does get refreshed.
I’d like some answers here too. In my playground app, it seems like a low refresh time (5 minutes) works at first; but after a couple hours it stops updating entirely. That’s unacceptable. I’d like to know what my budget is, and how to update as often as possible without using it up.
Closest I've found as a response to this is around "15 mins" from https://developer.apple.com/forums/thread/653265?answerId=619739022#619739022

Updating every minute is far too aggressive. Widgets have a limited number of updates and if you were to try to update every minute, you'll quickly run out of updates. While debugging with Xcode these limits are not imposed, but if you're running your app outside of Xcode you'd see the behavior you're describing where your widget would stop updating. 

What happens if you update every 15 minutes? If that doesn't work, please file a Feedback Assistant report with the details of what you're doing and the results you see.

Posted by pdm

Adding my voice to the chorus: would really appreciate solid/transparent guidelines on how frequently content can be refreshed and what factors go into the refresh budget.
I want share some information that I found as of Nov. 25, 2020
  1. the widget refreshing is triggered by chronod service, hence the distance between refresh timeline can't be very short like 1 second, it's triggered around 5 minutes gaps even I give 1 second

  2. there is refresh budget which is managed by dasd, talking about my app, it is given 75.0 point at some point and decreasing 1.0 on every refresh. however, the budget is increased 0.1~0.2 from time to time

based on the things that I found, I expect it will refresh around 80~90 times a day

I've recently found some Apple article on this https://developer.apple.com/documentation/widgetkit/keeping-a-widget-up-to-date

I think this explains pretty well the overall approach.