Widget does not render all the time

Hello everyone !

I encountered an issue while developing a widget:
  • Sometimes the widget renders a blank screen, without any content (in the springboard and in the widget gallery).

  • Some other times it renders an "old" version of the widget with blurred images and texts, looking like a cached snapshot (maybe)

I assume that it may means that the widget is crashing during the rendering, but sometimes it works well.

After erasing all contents and settings from the simulator I can reinstall the widget and it seems to work fine for a limited time and the issue appears again later on.

Has anyone encountered this kind of issue ?

Thank you 😊


Answered by LKFab in 630904022
Hello,

Just a quick update, the problem resolved itself in the beta 6 version of Xcode 😊
You are definitely not alone in seeing this issue. I am constantly struggling against it. Unfortunately, I also don't have any real solution for you. I have a few different widgets and I have done a far bit of testing to try to figure out what is going on. I can provide a few notes in case that helps you or anyone else get closer to a solution.
  • The preview view is generated one time and then seems to be cached forever. Although I haven't tested this, I believe you would have to completely delete the app to get the preview to refresh. This is relevant because if you happen to have had a blank preview initially it will continue to be blank even if you have changed the preview since then.

  • The less my widgets need to do while generating the timeline entries, the more likely they are to succeed. One widget is only pulling a few user configured values from the main application and it works nearly 100% of the time. Other widgets need to retrieve a significant amount of data from a database. Logging tells me that those widgets are always completing the timeline generation work, but then the data often just completely fails to show up in the widget itself.

  • While the widget will appear blank if your extension crashes in some way, it does not appear to be the only reason it can be blank. I have seen it be blank many times without any sign that it had crashed and plenty of evidence to the contrary.

For whatever it is worth, I am testing on a real device (iPhone X) and not the simulator.

Accepted Answer
Hello,

Just a quick update, the problem resolved itself in the beta 6 version of Xcode 😊
Widget does not render all the time
 
 
Q