I have created widget which supports medium and large family similar to news feed app like title and image by configuring the medium widget with 2 articles and large with 4 articles where each article has title and it's image with size 46x46 and 61x61.
When am adding the small and large widgets to my Home Screen getting memory limit (Thread 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=30 MB, unused=0x0)(crash and the widget is not refreshing and some times widgets is showing the skeletons instead of data.
This is my timeline provider func getTimeline(in context: Context, completion: @escaping (Timeline) -> Void) {
widgetVM.getRecommendedDataForWidget{ (result) in
switch result {
case .success(let items):
let entries = getRecommendedWidgetTimeLineEntries(recFeedModel: items)
let timeline = Timeline(entries: entries, policy: .atEnd)
completion(timeline)
case .failure(_):
let entry = RecommendedWidgetEntry(date: Date(), recommedationData: WidgetFeedModel.getPlaceholderData())
let timeline = Timeline(entries: [entry], policy: .never)
completion(timeline)
}
}
}
else {
if accessTokenValue == nil { // if token is nil then considering it as member is not logged in.
let entry = RecommendedWidgetEntry(date: Date(), recommedationData: [])
let timeline = Timeline(entries: [entry], policy: .never)
completion(timeline)
return
}
}
Could you please help me out on this as this is priority for me as part of app release. I couldn't find out the reason for this.
Thanks