Can't pin down how to show complications properly at different stages

I understand that complications in WidgetKit and watchOS 9 are different to the old ClockKit way, and I'm trying to populate the getSnapshot, getPlaceholder and getTimeline functions appropriately for the new method.

I'm using dynamic intents, and I've got that working and providing a set of items I want the user to choose from, but at the various stages of selecting and adding a complication to the watch face, nothing I do seems to work properly on a device, and sometimes in the Simulator.

On the Simulator: 1: The previews all use the same data, but getSnapshot() is supposed to return the data specific to that event from the configuration, i.e. if let theId = configuration.event?.identifier. "Christmas" is correct, but "Gallery Opening" is using Christmas's data.

Are you only supposed to show ONE particular bit of data, like some dummy preview data or something? I can do that, but the complication picker then just looks really boring, with just the text below being different. I note that Apple's weather complications show different data. How did they do that?

2: You can see that once I pick an event it's displayed correctly in the Watch face edit screen:

The "72d" circular complication is the "New York" event, and the rectangular one is correctly using the data for the "London Party!".

3: Once I've selected the events I want to use in those complications the edit screen shows them as totally blank, not even a placeholder. Which method gives us that preview?

4: Once I confirm the edits and return to the Watch face, the complications appear correctly:

Note: This is all from the Simulator (apart from the image of Apple's Weather complications). This stuff barely works on a device. Half the time the complications are all placeholders, and half the time they're using the wrong data! If it works in the Simulator, it should work on the phone, or there is no point in giving us the Simulator if the results are different.

So basically:

  • Q1. How do I use different data in the complications picker?
  • Q2. How do you get the previews to show when you're in edit mode?
  • Q3. Does anyone know how to get print() statements to work when I'm running the Complications scheme? I could answer all these questions myself if I could output some debug info to the console, but all I see is the output from the Watch App target...
Answered by darkpaw in 728283022

A partial fix can be found here.

I've spent an entire day trying to get this to work, and failed to do so. It's clearly broken in Xcode, the Simulator, watchOS 9 and iOS 16. I just hope Apple get their trillion-dollar act together and fix these simple things before they push out the full release.

(Oh, and it would be nice if some Apple engineers would step in here and there and help out the developers who are hitting these ridiculous issues every day.)

I am having the exact same issue, thanks @darkpaw for such a detailed description. I was about to go crazy trying to figure out why it wasn't working as expected. Even the EmojiRangers app supplied as example has the same issue (https://developer.apple.com/documentation/widgetkit/building_widgets_using_widgetkit_and_swiftui).

I was hoping that this would have been fixed in iOS 16 GM, but it's still behaving erratically.

Cheers!

Right, well, after having consulted the vast swathes of info on this (there is none), I've come to the conclusion that I must be doing something wrong since other developers have released apps with complications and widgets that work.

Even the code that worked on iOS 15 doesn't work on iOS 16, so this is going to take forever. Sorry, customers! No updates for you yet.

Having the exact same set of problems here with complications and WatchOS 9 & iOS 16. Wondering if it might be an Xcode 14 problem too as its causing problems for an old version of my app that used to work. An update from Apple Engineers would be very appreciated...

Still not working properly on the latest iOS 16.1 beta.

Apple, if one of your engineers is reading this, can they please help us out?

I'm thinking of just getting rid of my Watch app. Complications don't work properly. Widgets that used to work perfectly well on the iOS Home Screen don't work anymore - and the code hasn't changed. It's frankly pathetic that no one from Apple is responding to developers when they have these issues.

Accepted Answer

A partial fix can be found here.

Did anyone find a fix on this issue? I just opened an issue in the feedback assistant:

Please provide a descriptive title for your feedback: Widgets in Watch Widget Gallery are not rendering correctly

Which area are you seeing an issue with? Something else not on this list

What type of issue are you reporting? Incorrect/Unexpected Behavior Details

How often does this issue occur? Always Description

Please describe the issue and what steps we can take to reproduce it: The issue can be reproduced in the Emoji Rangers example App provided in the documentation (https://developer.apple.com/documentation/widgetkit/building_widgets_using_widgetkit_and_swiftui%29). Widgets are not rendered correctly in the Widget gallery. The "description" string for each widget does not match the rendered preview. Once the widget is chosen it will render correctly on the watch face but will go black whenever we enter the watch face edit mode. I provided a screen recording of the unexpected behavior. Also, this forum post describes the issue in detail: https://developer.apple.com/forums/thread/713397.

I'm also having these problems with complications that use configuration intents and it would be great to get some clarification from Apple engineers. Even the EmojiRangers sample code doesn't work correctly on device. The same code that doesn't work properly for watchOS complications works on iOS as lock screen widgets.

I am having issues with static complications. Everything works perfectly except when the user is in the "watch face selection" screen. On this screen, the preview doesn't show at all.

The preview shows correctly when editing the watch face (style, colors, complications, etc.), just not on the watch face section screen. Confirmed on simulator and physical device.

Anyone else in this boat? This behavior is easily reproducible by creating a new WatchOS WidgetKit target and running the app with no code modifications...

Thank you!

I had already add iOS lock screen widget and watchOS complication using WidgetKit for app. Maybe I can give some tips.

  1. For question one, I'm also having this problem, And code is right definitely. Finally resolved by upgrading the watchOS version. Now watchOS version upgrade to 9.1(20S75) from 9.0.xx. ( iOS Version is 16.0, Xcode version is 14.0.)

2.When edit the complication, getSnapshot will called and return the entry. In my situation, the logic in getSnapshot and getTimeline almost same, except return different value. So you can try.

  1. In debug mode, my watch app setting :

So I can select watch app scheme build and run. The watch complication can also build and run the same way.

You can add new scheme for Watch widget extension, build and run.

I have a similar problem on real devices. When I edit complications on Apple Watch, it works fine. I can see my widget preview when selecting what complication I want to add to watch face.

But, in the watch app on iPhone, the complication preview is blank on My Faces. But when I tap into individual face, I can see my widget complications. However, the information on my widget complication is wrong. It's supposed to be information from my snapshot but it's not.

Very buggy indeed.

Can't pin down how to show complications properly at different stages
 
 
Q