NSFetchedResultsController

Hi


I am creating an NSFetchedResultsController and setting the sectionNameKeyPath to a non nil value and am getting the following error when I perform the fetch:


API Misuse: Attempt to serialize store access on non-owning coordinator


This is on Mac OS Siera using XCode 8.1. Setting the sectionNameKeyPath to nil, and hence only creating a single section in the results has the effect of not causing the error.


Has anyone else had similar problems?


Michael

Hi

This issue already exists. Does anyone found a solution for this?

I found this after experiencing the exact same error, and also did not occur when using nil for sectionNameKeyPath.


After additional research I found that using:


moc.save()


(where moc is your NSManagedObjectContext)


immediately prior to creating the NSFetchedResultsController resolved the problem. I do not understand why this solves the problem, as (near as I can determine) I have nothing unsaved at that point. It does, however, fix the error. Go figure.

Hi Mitch


That solution works if your user has saved the doc.


However, this solution kind of suggests it has something to do with the autosave feature of NSDocument. Will investigate...


Michael

Hello,


I know this issue is old but I am observing the same error message. I am not sure what specific operations are causing it. I can't seem to pin that down. However the Core Data setup in the app is done using a UIManagedDocument and in addition I am adding some private queue concurrency contexts where the parent is the managed context in the document. Auto save is turned on. It seems to come out at some point after the auto save. The app is also doing explicit save of the private contexts. I don't see any ill affects due to it but I would like to get to the bottom of the issue.


Thanks,
Robert

In my case, I wasn't using NSDocument/UIDocument. I'm using a NSFetchedResultsController(Delegate) as the data source for a UITableView.

Hi Robert


Its been a while. From memory, I think the problem was not so much with NSFetchedResultsController, but in the way I was constructing my managed objects in the first place. I think I was using the constructor of the NSManagedObject, and not NSEntityDescription.insertNewObject. Since using NSEntityDescription, I have not seen this error since.


Hope this helps.


Michael

Thanks Michael,


I checked the code and all the object creation is being done NSEntityDescription.insertNewObject so must be something else.


Regards.

Robert

NSFetchedResultsController
 
 
Q