Open Jerland2 opened 6 years ago
Can you provide a small example project that demonstrates the issue?
@paulw11 as requested here is a sample project displaying the bug/problem. also I will describe steps to reproduce below: https://github.com/Jerland2/SeamPredicateTest
Steps to reproduce:
@paulw11 Wondering if there is any update/eta on this fix? I am really eager to add this feature to my app!!
I have been looking at this and I don't believe that it can be resolved. You can use the object context change notification as a trigger to reload your data and refresh your tableview. Something like:
NotificationCenter.default.addObserver(forName: NSNotification.Name.NSManagedObjectContextObjectsDidChange, object: CoreDataController.shared.viewContext, queue: nil) { (notification) in
self.loadData()
}
Add a self.tableView.reloadData()
to your loadData
function
@paulw11 this is sad news, perhaps you could reference why you think it isn’t possible for someone to implement in the future here?
Your suggestion would work for my reloading, however it still does not support the entire FRC delegate pattern, which is a HUGE issue as far as supporting Core Data and apps that use FRC’s to perform operations.
The problem seems to be with the way the FRC monitors changes and the disconnect between CloudKit references and the local MOC references. I have found a different predicate that you can use in your sample that works with the FRC delegate:
fetchRequest.predicate = NSPredicate(format:"booksToPerson.name = %@", selectedPerson.name!)
This predicate pattern worked for me. In my case, I generate a unique UUID key for my Person entity so I can compare something much more likely to stay unique and keep on using FRC.
Is there any chance someone could add support for Fetched Result Controllers and their delegates with the predicate method for NSPredicates? When using the predicate method my fetched result controllers fail to trigger its delegate methods. I have confirmed (at least I believe) that this issue is caused by the generated predicate due to the following SOF post: https://stackoverflow.com/questions/17151160/nsfetchedresultscontroller-delegate-not-called-for-api-listener