I have NSFetchedResultsControllerone that I installed as follows:
let fetchRequest = NSFetchRequest(entityName: "Order")
fetchRequest.includesPendingChanges = false
fetchRequest.sortDescriptors = [
NSSortDescriptor(key: "status", ascending: false),
NSSortDescriptor(key: "date", ascending: false)]
self.fetchedResultsController = NSFetchedResultsController(
fetchRequest: fetchRequest,
managedObjectContext: DataStoreManager.sharedInstance.mainContext,
sectionNameKeyPath: "section",
cacheName: nil)
do {
try self.fetchedResultsController.performFetch()
} catch let error as NSError {
print(error)
}
The problem is even when set includesPendingChangesto false, it still causes calls controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?)every time I create a new object in context (without saving).
Is there anything else I should look for to avoid this situation?
source
share