CoreData with CloudKit in WidgetKit not working

In my app, I have an NSPersistentCloudKitContainer set up in the following way:

Code Block swift
    let container: NSPersistentCloudKitContainer
    init() {
        self.container = NSPersistentCloudKitContainer(name: "Model")
        self.container.persistentStoreDescriptions[0].setOption(
            true as NSNumber,
            forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey
        }
        self.container.loadPersistentStores { (_, error) in
            guard error == nil else {
                print("error loading store: \(error.debugDescription)")
                return
            }
        }
        
        self.container.viewContext.automaticallyMergesChangesFromParent = true
    }


When I invoke a fetch request on the context of the container in my iOS target, it works as expected. However, when I perform the same fetch request in my Widget target, it returns an empty array result.

In my iOS target, I have Background Modes / Remote Notifications and iCloud / CloudKit capabilities. In my Widget target, I have the iCloud / CloudKit capability.

Not sure why it isn't working, so any help would be much appreciated, thanks!
I have been trying to get this to work as well, with no luck yet.

Adding to the things you have tried, I have noticed the Widget is able to access CloudKit data for me, on my device, but fails to work for any one else on TestFlight.

Hoping this is temporary during the beta. Any help would be extremely helpful. Thanks!
I can confirm that Core Data with CloudKit as mention before has serious problems when Testing on Device in iOS14. In particular when Saving data to MOC.
Bug reports ?
CoreData with CloudKit in WidgetKit not working
 
 
Q