Refresh SmartStack Widget in watchOS 11

Hi,

I have an app that provides a SmartStack Widget.

The content in that widget is dependent on a state inside the application so from time to time the app needs to update the widget state.

I tried:

WidgetCenter.shared.invalidateConfigurationRecommendations()
WidgetCenter.shared.reloadAllTimelines()

However this does not have any effect.

I only see updates on reboots (device with watchOS 11 B5)

Is there any other way or am I doing something wrong?

Answered by arno_app in 800656022

Thanks for your reply.

With further debugging I was able to isolate the issue. It was no bug with the beta but rather with my model not staying in sync between the main app and the widget.

After fixing this my code above worked reliable.

Does the issue happen on watchOS 10 as well? If it does, would you mind to try the following Apple sample to see if it reproduces the issue? (We updated the sample recently but I haven't had a chance to try with watchOS 11.)

You can do it with the following steps:

  1. Follow the Readme to run the apps on your iPhone and Apple Watch,

  2. Follow the Readme to install the complication. After that, you will see the complication appearing in the smart stack as well.

  3. Tap TransferComplicaitonUserInfo from the iOS app.

  4. Bring the watch app to the foreground.

  5. Switch to the watch face to check if the complication updates.

Step 3 eventually triggers WidgetCenter.shared.reloadTimelines(ofKind: widgetInfo.kind) on the watchOS app side, which, after step 4, updates the complication.

If the issue happens only on watchOS 11, I’d suggest that you file a feedback report (http://developer.apple.com/bug-reporting/) and share your report ID here for the watchOS folks to take a look.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Accepted Answer

Thanks for your reply.

With further debugging I was able to isolate the issue. It was no bug with the beta but rather with my model not staying in sync between the main app and the widget.

After fixing this my code above worked reliable.

Refresh SmartStack Widget in watchOS 11
 
 
Q