Post

Replies

Boosts

Views

Activity

WidgetKit widget is missing from the widget gallery
My app just got rejected from TestFlight external testing review, because they were unable to find my new iOS 14 widget in the widget gallery. And when I'm debugging it all works just fine, but when I'm installing a test build from the TestFlight app, the widget is actually missing. My minimal iOS version for the App is 13.0, and for WidgetKit widget extension it's 14.0. Deployment target is set to 14.0 (was set to 13.0, didn't help). The app comes with the bundle of three extensions: iOS 13 Today Extension, iOS 14 WidgetKit widget, and Intents extension. When I'm debugging it all works as expected. I also have the following warning when sending the build to App Store Connect: "ITMS-90473: CFBundleVersion Mismatch - The CFBundleVersion value '156' of extension 'Intents.appex' does not match the CFBundleVersion value '157' of its containing iOS application." Can this be a problem for the widget not appearing in the gallery?
8
0
4.7k
Aug ’20
How to use Timer in the new Widget API?
I'm building a new widget for one of my apps, and the new Text initializer init(_:style:) is not enough for me. I need to have some control over which NSCalendar.Units are displayed, so I'm trying to use DateComponentsFormatter here. I have to use my own Timer because of that, and here's my code. struct TimerText: View {     let date: Date     let allDay: Bool     let unitFlags: NSCalendar.Unit     private let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()     @State var duration: String?     init(date: Date, allDay: Bool, unitFlags: NSCalendar.Unit) {         self.date = date         self.allDay = allDay         self.unitFlags = unitFlags         updateDuration()     }     func updateDuration() {         duration = systemDurationString(date, allDay: allDay, unitFlags: unitFlags)     }     var body: some View {         Text(duration ?? "—")             .font(.system(.title, design: .monospaced))             .onReceive(timer) { _ in                 updateDuration()             }     } } systemDurationString function uses DateComponentsFormatter inside and returns the formatted string. Unfortunately, onReceive callback never gets called. I thought this might be a problem with RunLoop that I've chosen, but it's seems like .current doesn't work either.
2
0
1.3k
Jul ’20