0

When I run the code snippet below, WidgetKit is supposed to request a new timeline at the end of each minute according to the Apple's documentation.

Code Block 
let currentDate = Date()
let futureDate = Calendar.current.date(byAdding: .minute, value: 1, to: currentDate)!
let timeline = Timeline(entries: [
      Entry(date: currentDate, number: Int.random(in: 0...10))], policy: .after(futureDate))
completion(timeline)

But it just works once and nothing happens afterward as if it has been set to .never. I am trying it on iOS 14 Beta 2.

amone
  • 3,712
  • 10
  • 36
  • 53
  • Please refer my solution here: https://stackoverflow.com/questions/62873336/ios-widgetkit-widget-not-getting-updated-even-when-userdefaults-are-synchroniz – Abhishek Bedi Jul 13 '20 at 09:52
  • My widget requests new timelines, but only for a few hours after it's run. Then it just completely stops. If I add a new widget, that one will work for a while, but the original widget never updates (even if I call reloadAllTimelines from inside the main app). – bmueller Jul 24 '20 at 04:27

1 Answers1

0

That's because your updates are too aggressive. Change it to 15 minutes and it will work

XcodeNOOB
  • 2,135
  • 4
  • 23
  • 29