WidgetCenter.shared.reloadAllTimelines() doesnt work when app in background

I have an iOS app, watchOS app, and iOS Widget that shows the most recent data in the database.

The watch app sends data to the iOS app over the WCSession and is received in session(didReceiveMessage, replyHandler). After that data is processed, reloadAllTimelines() is called.

When running in Simulator or on device plugged in to debugger, it works, the widget updates when the app is closed (in background, even if force quit).

But when running TestFlight or App Store build, the data is still processed and saved to Core Data (I open the app and it's there), but the widget doesn't update.

It seems that reloadAllTimelines only works when the app is in foreground (at least in non debug builds). I dont have an iOS 17 device to check but I think this is a recent bug with iOS 18.

Same problem when observing NSNotification.Name.NSCalendarDayChanged

code executes, but reloadAllTimelines doesn't refresh the widget

So I dont think this is related to WatchKit session, it's because the app is in background.

WidgetCenter.shared.reloadAllTimelines() doesnt work when app in background
 
 
Q