Post

Replies

Boosts

Views

Activity

Changing widget configuration not always calling "getTimeline" method
I have a sensor widget, which displays the name of the selected sensor, scale and value. A sensor is selected by editing the widget, sensors list is passed dynamically to the sensor intent. Before selecting any sensor(right after adding a widget to homescreen), a simple message "Edit and select a sensor" is shown. The issue is after selecting a sensor from the sensors list, the widget's "getTimeline" is sometimes not triggered, which results in showing "Edit and select a sensor" always!! From the main app, on start, all the widgets are manually refreshed using "reloadAllTimelines" method. So when the app is opened the "Edit and select a sensor" message gets replaced with the correct/selected sensor details. Current Behaviour "getTimeline" sometimes not called even after changing a widget's configuration. Expected behaviour "getTimeline" should be reliable and should get called when a widget is edited and configuration is changed.
0
0
568
Feb ’21
Widgets not working in release/TestFlight builds
The widgets works perfectly fine when debug built on a simulator. But when release scheme is built on a real device, it shows blank with some placeholder view, and editing widget does not work. Using Xcode Version 12.4 (12D4e) Real device(SE 2) running iOS 14.4 TestFlight build also having the same issue. Have a configurable widget with the builder configuration as follows swift struct SensorWidgetBuilderUIView: Widget {  let kind: String = "SensorWidget"     var body: some WidgetConfiguration {   IntentConfiguration(kind: kind, intent: SensorWidgetIntent.self, provider: SensorProvider()) { entry in    SensorWidgetEntryView(entry: entry)   }   .configurationDisplayName(LocalizedStringKey("sensor_widget"))   .description("dummy")   .supportedFamilies([.systemSmall])  } } In the real device'c console I could see some errors: Error on adding widget to homescreen shell Can't create SBHWidgetConfigurationInteraction because missing widgetDescriptor (private) or widgetIntent ((null)) 2. Error after adding shell No intent in timeline(for:with:completion:) [com.telldus.live.mobile.HomescreenWidget:SensorWidget] reload: failed with error The operation couldn’t be completed. (CHSErrorDomain error 1101.)) Here is my getTimeline implementation: swift func getTimeline(for configuration: SensorWidgetIntent, in context: Context, completion: @escaping (TimelineEntry) - ()) {   let date = Calendar.current.date(byAdding: .minute, value: SensorProvider.updateIntervalInMinutes, to: Date())!   WidgetUtils().getSensorSimpleEntry(configuration: configuration) {sensorWidgetStructure in    let entry = SensorSimpleEntry(date: date, sensorWidgetStructure: sensorWidgetStructure)    let timeline = Timeline(entries: [entry], policy: .atEnd)    completion(timeline)   }  } I have tried this - https://developer.apple.com/forums/thread/655393?answerId=625976022#625976022 solution, but with no luck! I would appreciate any help, Thanks in advance!
2
0
2.6k
Feb ’21