I integrated new ios 14 widgets in my app, and i am seeing a spike of apis when widget are being reloaded.
So to give perspective what i have done is that i make 2-3 api calls to get data in order to show in widget and after every 30 mins they are reloaded as shown below.
But the issue i am facing is that in analytic chart i am seeing api spike every 30 mins and not in between(or scattered) for collective users.
In my understanding if a user A adds widget at 1:00 so widget should be reloaded at approx 1:30 and if user B adds widget at 1:10 it should be reloaded at 1:40, but instead i see that a triangle spike at 1:30, 2:00, 2:30 etc.
Is someone else facing the same issue or I am missing something?
Asked apple about it, it gave me links on how to reload using widgetcenter or their guide from which i made my widgets.
func getTimeline(in context: Context, completion: @escaping (Timeline<WidgetEntry>) -> Void) {
WidgetManager.shared.fetchData(widgetFamily: context.family, completion: { widgetData in
let date = Date()
let relevance = TimelineEntryRelevance(score: 70)
let entry = WidgetEntry(date: date, relevance: relevance, widgetData: widgetData)
let nextUpdateDate = Calendar.current.date(byAdding: .minute, value: 30, to: date)!
let timeline = Timeline(entries:[entry], policy: .after(nextUpdateDate))
completion(timeline)
})
}
Post
Replies
Boosts
Views
Activity
Hi
This is same as this https://developer.apple.com/forums/thread/650831
But i am still getting the error. Tested on device with ios 14 released 16 sept and using xcode 12 (Build 12A7209).
Anyone else also facing this issue?
Hi
I am making api call to show data in widgets, initially supporting all families in my configuration. My question is can we update the family after getting the response from api depending on how much items i receive from my server especially in large widget.
I want to show 4 items in large widget but if api gives me 2 or less items i dont want to give user option to add large widget.
Is there anything written in apple documents ? Couldn't find it.
Hi,
Anyone facing problem with progressview not showing in ios 14. I have used Xcode 12 beta 6 and 7 to create new advanced widget and i wanted to show progressview but a yellow image with red cross is being shown. Tried this
VStack(alignment: .leading, spacing: nil, content: {
ProgressView()
}
OR
VStack(alignment: .leading, spacing: nil, content: {
ProgressView("Downloading", 50, 100)
}
This shows only "Downloading" and not horizontal bar.
Am i missing something? Watched mainy videos where it was working and they were using xcode 12 beta 2 or 3