Older watch app with extension template, unable to load any saved data from UserDefault watchOS 9 beta 7

Hi all,

I am working with an older watch app that still uses the older template that combines the WatchKit App and WatchKit App Extension targets.

While trying to migrate the ClockKit complication to the new WidgetKit complication, I cannot get the widget complications to load anything from user defaults. It seems like the widget complications are not using the same user defaults as the watch app though being in the same App Group.

I experimented with a new watch app using the new SwiftUI template and the WidgetKit complication was able to load data from user default successfully.

Did anyone got WidgetKit complication to load data successfully from user default with the older watch app template?

Thanks in advance!

Replies

Did you ever figure this out? Having the same issue. I sent data from my phone to the watch app and saved it to the appgroup and the watch app has all the userdefaults working fine. When trying to access those same userdefaults for the complications, it doesn't work.

Ditto... anyone out there have a solution for this? I saw elsewhere someone commented on using Keychain instead - doesn't seem like the right way to go, but it may be an avenue, all else fails.

Same here and still couldn't figure it out. But...if I wait for hours (not more than 24 hrs), and restart my Apple Watch few times, the widget finally reads correct data from userDefaults.

Here what I got.

  1. When I first install app on Apple Watch, in the AW app itself I can see correct data in userDefaults that are sent from iPhone. This is working right away.
  2. But, when the widget renders, it does not use the latest updated data in userDefaults. It uses default value in userDefaults. (the values that I initialize it with)
  3. Now... I have to wait for hours, with a help of free restart the Apple Watch.
  4. Once the widget renders correctly, that is it using the latest updated data from userDefaults, it will continue to use this. Subsequent widget rendering will have no issue. userDefaults in Apple Watch's app and the widgets are the same.

Still don't know how to fix this.. Right now I just advice users to wait.....