Post

Replies

Boosts

Views

Activity

Reply to StaticConfiguration.init(kind:provider:placeholder:content:) deprecated warning
ok, I implemented the new (in beta 3) method: placeholder(with: Context). The widget shows up on the device when I run locally, but when distributed using TestFlight, HomeWidget disappears and cannot be added. Here his my code for the TimeLineProvider. What am I missing?     public typealias Entry = SimpleEntry     let dict_dummy = ["Gizmo": ["SOC": 89, "ratedRange": 196, "estimatedRange": 185, "unit": "mi", "isTestUser": true]]     public func snapshot(with context: Context, completion: @escaping (SimpleEntry) -> ()) {         var  dict = defaults?.dictionary(forKey: Constants.WIDGET_DICT)         if dict == nil {             dict = dict_dummy         }         let entry = SimpleEntry(date: Date(), dict: dict)         completion(entry)     }     public func timeline(with context: Context, completion: @escaping (Timeline<Entry>) -> ()) {         let currentDate = Date()         let refreshDate = Calendar.current.date(byAdding: .minute, value: 10, to: currentDate)!         let dict = defaults?.dictionary(forKey: Constants.WIDGET_DICT)         let entry = SimpleEntry(date: Date(), dict: dict)         let timeline = Timeline(entries: [entry], policy: .after(refreshDate))         completion(timeline)     }     func placeholder(with: Context) -> SimpleEntry {         let entry = SimpleEntry(date: Date(), dict: dict_dummy)         return entry     } } @main struct HomeWidget: Widget {     private let kind: String = "HomeWidget"     public var body: some WidgetConfiguration {         StaticConfiguration(kind: kind, provider: Provider()) { entry in             HomeWidgetEntryView(entry: entry)         }         .configurationDisplayName("Stats Widget")         .description("Shows battery SoC and Rated Range")         .supportedFamilies([.systemSmall, .systemMedium])     } }
Jul ’20
Reply to Widgets not working with TestFlight since Xcode 12 beta 3
Right Xcode beta 4 still has the problem. I discovered that to reproduce the problem you don't even need to submit through TestFlight. Just building in Xcode as release (vs debug) causes widgets to disappear. I have also tried the "dead-code stripping" settings in "build settings" for the target and changing that does not fix the problem either. Given that HomeWidgets is an important feature of iOS 14, it's strange that Apple has not tested this once and even stranger that after filing bug reports against beta 3, they still have not fixed the problem in beta 4.
Aug ’20
Reply to Today Extensions Deprecated?
HomeWidgets cannot have buttons and actions. Yes, I know that you can use the HomeWidget to launch the app and pass a parameter to it do something that you want, but that is not the same thing as what's possible with Today Widgets which does the job without launching the app. Deprecating Today Widgets without a replacement seems short-sighted.
Sep ’20
Reply to Display UIViewRepresentable in WidgetKit
I've tried MKMapSnapshotter in the TimelineProvider as suggested in the accepted answer, but the completion handler of the start is never called (snapshot is a MKMapSnapshotter object and I have verified that the callback is called when this code runs on the actual app and not the widget TimelineProvider. What am I missing?       let image = snapshot?.image // Image(uiImage: snapshot?.image)       completionHandler(image)     }
Nov ’20
Reply to Map View in a Widget
The problem is that MKMapSnapshotter.start does not run while the app is in the background and th callback is never called in TimelineProvider. Have you actually tried this? I have tried it and the completionHandler for MKMapSnapshotter.start is never called in TimelineProvider.
Nov ’20
Reply to In-app purchase localization issue
One year later this issue still exists. Can anyone tells me if the issue has been solved for them and if there is a workaround? Specifically, my app has 7 localizations for subscriptions (IAP). The app shows Dutch localization for users whose device is sent to English (including myself). There is a yellow dot next to some of the localizations. All in-app purchases have been approved a few days ago.
Feb ’22