I have an app that has a main target, a Share Extension and an App Extension.
I save data from any of the extensions, but the UI is never updated on the main app when going back into it if the app was on the background (alive, not terminated).
If the app was terminated, it all works as expected because it loads everything from scratch. If the app was on the background, it's not updated until a save
from an unrelated part of the code occurs.
It feels like @FetchRequest
's is not aware of remote (meaning from other processes) changes, is this something that has to be done manually?
I have both suggested options enabled:
storeDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
storeDescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
When using UIKit
with an NSFetchedResultsController
, you could simply call performFetch
to force the refresh of the controller when the app became active, but I don't see a way to force a refresh on a @FetchRequest
.