Posts

Post not yet marked as solved
2 Replies
Thanks @Claude31 As per my understanding, Apple is not declared/confirmed that the app will be rejected if the 3rd party SDK's doesn't provide their manifests. Could any one help me out with the Apple reference for the above one.
Post marked as solved
9 Replies
yes you are right. Am saving the compressed quality image into userdefaults and loading the image with actual resolution from user defaults and while displaying resizing the image based on widget like 61x61 and 46x46. As per your suggestion now I am saving the image with 200x200 into user defaults and getting the same while displaying it as 46X46 for medium and 61x61 for large into widgets and. But still am getting memory limit exception while rendering the both medium( has two articles with images) and large family widgets (4 articles with images). Working fine when rendering the data for medium widget ( with two articles and two images). Note: Both the widgets has same data but no of records vary. Any suggestions on this.
Post marked as solved
9 Replies
Saving images from timeline provider into UserDefaults by compressing the quality and calling the getImageFromUserDefaults bind the image which was saved.  //Get the images from the User Defaults based on resId.     static func getImageFromUserDefaults(key: String) -> UIImage? {         if let userDefaults = UserDefaults(suiteName: userDefaultsAppGroup) {             if let imageData = userDefaults.object(forKey: key) as? Data,                let image = UIImage(data: imageData) {                 return image             }         }                  return nil     }          //Save the images into User Defaults, reId as Key     static func saveIntoUserDefaults(image : UIImage, resId: Int) {         if let userDefaults = UserDefaults(suiteName: SharedContentConstants.userDefaultsAppGroup) {             if let jpegRepresentation = image.jpegData(compressionQuality: 0.5) {                     userDefaults.set(jpegRepresentation, forKey: String(resId))                 }         }     }
Post marked as solved
9 Replies
Again facing memory limit issue on my device after two days. Getting crashed when saving the image to file system. Added the memory graph and object graph for the same. Don't no how to move forward with remote images on my widgets. Kindly suggest the way how to overcome this low memory issue.
Post not yet marked as solved
3 Replies
As you suggested I have added only two timeline entries but still the widget is not getting auto refreshed.     func getTimeline(in context: Context, completion: @escaping (Timeline<RecommendedWidgetEntry>) -> Void) {         let accessTokenValue = Keychain.getAccessTokenValue()         if let token = accessTokenValue, !token.isEmpty  {                widgetVM.getRecommendedDataForWidget{ (result) in                     switch result {                     case .success(let items):                         widgetVM.downloadImages(recommendedData: items) { (result) in                             switch result {                             case .success(_),.failure(_) :                                 var refreshEntries: [RecommendedWidgetEntry] = []                                 if let At6AM = Calendar.current.date(bySettingHour: 6, minute: 0, second: 0, of: Date()) {                                     let refreshEntryFor6AM = RecommendedWidgetEntry(date: At6AM, recommedationData: items)                                     refreshEntries.append(refreshEntryFor6AM)                                 }                                 if let At6PM = Calendar.current.date(bySettingHour: 18, minute: 0, second: 0, of: Date()) {                                     let refreshEntryFor6PM = RecommendedWidgetEntry(date: At6PM, recommedationData: items)                                     refreshEntries.append(refreshEntryFor6PM)                                 }                                 let timeline = Timeline(entries: refreshEntries, 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.                 SharedContentConstants.clearUserDefaultsData()                 let entry = RecommendedWidgetEntry(date: Date(), recommedationData: [])                 let timeline = Timeline(entries: [entry], policy: .never)                 completion(timeline)                 return             }         }     } On my timeline provider am calling the Rest API to fetch the data to update the widget. Could you please help me out is there any issue with the refresh policy ( My widgets must auto refresh twice a day like 6AM and 6PM) Kindly provide the reason, why the widgets are not autorefreshing on it's own. Thanks.
Post marked as solved
9 Replies
Am downloading the images like this and binding to widget UI. Correct me how can I proceed these memory limit issue. struct NetworkImage: View {          let url: URL?     var viewDimension : CGFloat = 46          var body: some View {             if let url = url, let imageData = try? Data(contentsOf: url),                let uiImage = UIImage(data: imageData) {                 AnyView( Image(uiImage: uiImage)                     .resizable()                     .aspectRatio(1, contentMode: .fit)                     .frame(width: viewDimension, height: viewDimension, alignment: .center)                     .border(Color(red: 0.957, green: 0.957, blue: 0.957), width: 2.0)                     .cornerRadius(4)                 )             }             else {                                  AnyView( EmptyView() )             }     } }