⌚️Hello,
I've noticed in watchOS 10 that when a complication is in the Smart Stack, the value of WCSession.isComplicationEnabled
is false
. I'm not sure if this is intentional or a bug. It seems trivial at first glance, but it actually affects the communication mechanism mentioned in Implementing Two-Way Communication Using Watch Connectivity.
In the following two scenarios, if the user has only added the app's complication to the Smart Stack, then the watch app will not be able to communicate properly with the iOS app.
Scenario 1 - WCSession.transferCurrentComplicationUserInfo()
// update complications from the iOS app
if WCSession.default.isComplicationEnabled {
let userInfoTransfer = WCSession.default.transferCurrentComplicationUserInfo(userInfo)
// ...
}
As described in Implementing Two-Way Communication Using Watch Connectivity, when the iOS app proactively updates the data of the watch app, since WCSession.isComplicationEnabled
is false
, WCSession
will refuse to transfer any data. This causes the standalone complication in Smart Stack to not be updated.
Scenario 2 - WKApplicationRefreshBackgroundTask
When the watch app uses WKApplication.scheduleBackgroundRefresh()
to periodically update data, as long as the user has added the app's complication to the watch face, the corresponding WKApplicationRefreshBackgroundTask
can be executed periodically in the background to fetch data.
However, if the user has only added complication to the Smart Stack, then the watch app will be completely purged, and the background task will not be executed at all. Although WCSession.isComplicationEnabled
is not directly used in this scenario, its behavior appears to be the same, that is, the complication in the Smart Stack is not considered a complication by the system.
Should I submit a bug report?
While complications can and should be built with WidgetKit, widgets in the Smart Stack are not complications. Widgets have different update mechanisms and budgets. WatchConnectivity is not an option for updating widgets.
You can find more information on updating widgets at https://developer.apple.com/documentation/widgetkit/keeping-a-widget-up-to-date