I am building a widget on Mac with Mac Catalyst. I notice that when I put my MacBook to sleep for roughly more than 2 hours, then after I wake the MacBook up, click on notification center, my widget shows Failed to Load. Then after a few seconds I click on notification center again, my widget shows up correctly.
My widget uses data from calendar and reminder. So I expect that the widget failed to load because of the data is not available.
I am thinking if I can execute a code (from my app) after MacBook wake up, I might be able to resolve this problem. Of course, this assumes that the app is still open (showing on a dock). Basically if I can detect when MacBook. wake up I can run some codes to refresh data.
Any advice is much appreciated.
Thanks, Boon