Post

Replies

Boosts

Views

Activity

Reply to WidgetKit complications won't update
Hi everyone, I'm having the same issue. What I found is that if the Watch App is open, or was recently put in background (less than a minute approx), transferCurrentComplicationUserInfo works fine. Otherwise, Complications are never updated, BUT once I open the Watch App again, ALL calls previously made to transferCurrentComplicationUserInfo are sequentially received in func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any] = [:]), and therefore Complications are updated. So the issue (at least in my case) seems to be that transferCurrentComplicationUserInfo doesn't wake up ExtensionDelegate. Is there anything new from Apple, or anyone who has managed to fix it without migrating to the SwiftUI lifecycle? Extra data: I made sure that the quota of 50 is not exhausted when I test. This is the ExtensionDelegate (summarized): class ExtensionDelegate: NSObject, WKExtensionDelegate, WCSessionDelegate { let session = WCSession.default override init() { super.init() if WCSession.isSupported() { session.delegate = self session.activate() } } func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any] = [:]) { WatchWidgetSessionHandler.shared.processComplicationUserInfo(userInfo) } } This is the code from the iOS side(summarized): class WatchAppDataManager: NSObject, WCSessionDelegate { override init() { super.init() let session = WCSession.default session.delegate = self session.activate() } func sendDataToWidget(for kinds: [WatchWidgetKind]) async { guard WCSession.default.activationState == .activated, WCSession.default.isComplicationEnabled else { return } let widgetsData = dataProvider.getData(for: kinds) if !widgetsData.isEmpty { WCSession.default.transferCurrentComplicationUserInfo(widgetsData) } } }
Dec ’23