'Limit to WidgetKit Timeline entries?

I'm creating an app that deals with a schedule-based widget. As a result, it should be updated constantly, but I'll know what the widget will look like far in advance. Is there a limit to the number of WigetKit timeline entries we're allowed to create at once? If I wanted to create a timeline of 100 entries, would it let me with no limitations? I want to create as many future entries as I can, but I don't want to slow down the speed in updating the widget when a user makes a change.



Solution 1:[1]

This is anecdotal, but I have done quite a lot of on-device testing (I make multiple widget apps) so I’m fairly confident in these numbers:

  1. Adding more than ~250 entries to a timeline seems to break with no reason given. 100 entries should be fine.

  2. There is also a time limit for timeline generation, i.e., if it takes more than 30 seconds of processor time to generate your timeline, your update process will be killed and your widget won’t update. That may not seem like a problem, but iOS 15 seems to seriously throttle widget updates so you may run into this limit more than you expect. If you run into this, the solution is to optimize your widget’s rendering time and/or generate fewer entries.

One last tip: always test on a device. Stuff that works in the simulator may not work on real hardware.

Solution 2:[2]

I have experienced this problem as well. I have multiple widgets for a user to choose from. When I added 1 or 2 widgets to home screen they work fine. But when I added more like 3-5 they start to fail to load. So I think there must be limit on number of entries. Also, complexity of widget layout has to be considered as well. I used to have a widget that is a month view, for instance 30 boxes and each box has its own data. If I have more entries for this widget, it will fail.

So... My guess is that it is not just number of entries but it is the overall size of the 'storage' your widgets need. And sadly this limit is unknown. (At least to me)

Lately I experienced weird situation. When I unlock my iphone, my widget will take some seconds to display. Sometimes it freezes in a placeholder view for 4-5 seconds, which is not good.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Ont Boonyawat