Posts

Post not yet marked as solved
0 Replies
136 Views
I have updated my Xcode version to 15.3 and my real iPhone device is on iOS 17.4. When I connect my iPhone to Mac, Xcode is not detecting my device. Which is a blocker for me to run my app on my device to test some important things which is not able to do it on simulator.
Posted Last updated
.
Post marked as solved
9 Replies
2k Views
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
Posted Last updated
.
Post not yet marked as solved
3 Replies
372 Views
Widget needs to be auto refreshed at 6AM & 6PM every day. I have added the following logic/code based on the widget adding time. But I could not see the widget is auto refreshing at 6AM & 6PM let calendar = Calendar.current           let TimeComponentfor6AM = DateComponents(calendar: calendar, hour:6)           let TimeComponentfor6PM   = DateComponents(calendar: calendar, hour: 18, minute: 00)           let now = Date()           let startOfToday = calendar.startOfDay(for: now)           let startTime    = calendar.date(byAdding: TimeComponentfor6AM, to: startOfToday)!           let endTime      = calendar.date(byAdding: TimeComponentfor6PM, to: startOfToday)!         if now < startTime {//if widget adds before 6AM             if let At6AM = Calendar.current.date(bySettingHour: 6, minute: 0, second: 0, of: Date()) {                 let refreshEntryFor6AM = RecommendedWidgetEntry(date: At6AM, recommedationData: recFeedModel)                 refreshEntries.append(refreshEntryFor6AM)             }             if let At6PM = Calendar.current.date(bySettingHour: 18, minute: 0, second: 0, of: Date()) {                 let refreshEntryFor6PM = RecommendedWidgetEntry(date: At6PM, recommedationData: recFeedModel)                 refreshEntries.append(refreshEntryFor6PM)             }             return refreshEntries         }         else if now < endTime { //if the widget adds before 6PM             if let At6PM = Calendar.current.date(bySettingHour: 18, minute: 0, second: 0, of: Date()) {                 let refreshEntryFor6PM = RecommendedWidgetEntry(date: At6PM, recommedationData: recFeedModel)                 refreshEntries.append(refreshEntryFor6PM)             }             let today = Date()             if let nextDayDate = Calendar.current.date(byAdding: .day, value: 1, to: today)             {                 if let At6AM = Calendar.current.date(bySettingHour: 6, minute: 0, second: 0, of: nextDayDate) {                     let refreshEntryFor6AM = RecommendedWidgetEntry(date: At6AM, recommedationData: recFeedModel)                     refreshEntries.append(refreshEntryFor6AM)                 }             }             return refreshEntries         }         else { // if widget added post 6PM             let today = Date()             if let nextDayDate = Calendar.current.date(byAdding: .day, value: 1, to: today)             {                 if let At6AM = Calendar.current.date(bySettingHour: 6, minute: 0, second: 0, of: nextDayDate) {                     let refreshEntryFor6AM = RecommendedWidgetEntry(date: At6AM, recommedationData: recFeedModel)                     refreshEntries.append(refreshEntryFor6AM)                 }                 if let At6PM = Calendar.current.date(bySettingHour: 18, minute: 0, second: 0, of: nextDayDate) {                     let refreshEntryFor6PM = RecommendedWidgetEntry(date: At6PM, recommedationData: recFeedModel)                     refreshEntries.append(refreshEntryFor6PM)                 }             } Kindly help me on it if anything missed or need to be added
Posted Last updated
.
Post not yet marked as solved
0 Replies
270 Views
Need to refresh the widget on daily basis twice at 6AM and 6PM by hitting the api. At each time to fetch the data from server and update the widgets at 6AM and 6PM with latest content. Could you please suggest how can I define my time lines entries.
Posted Last updated
.