Anyone getting the following error with Xcode 8 beta 6: Attempt to serialize store access on non-owning coordinator? Any advice how to eliminate it would be greatly appreciated.
-
You need to provide more context in your question. Is this a runtime error in your app? A compile error? Something else? Provide more details and relevant code as appropriate.– rmaddyAug 18, 2016 at 4:59
-
1It's a runtime error that I get when the following line of code is executed: let count = self.backgroundMOC.countOfFetchObjects(entityName: "Distribution", predicate: nil)!– fivewoodAug 18, 2016 at 6:46
-
have the same problem, maybe this is beta case and will be fixed in stable version– Adam SmakaAug 31, 2016 at 9:10
1 Answer
I saw the same error on performing performFetch on iOS 10.0.1:
- (void) refreshFetchedResults:(NSFetchedResultsController *)controller {
[self configureFetchRequest:controller.fetchRequest];
NSError *error = nil;
if (![controller performFetch:&error]) {
DDLogError(@"Unresolved error %@, %@", error, [error userInfo]);
}
}
}
As reported here, performing a save on the managedObjectContext associated with the NSFetchedResultsController before executing performFetch stops the warning from appearing. (In my case, there were changes to be saved.)
-
5Sorry I must disagree with this solution. It might solve the problem, but there are many cases where one might not want to save a context to perform a fetch. Context save may be expensive if done often (compared to a fetch), and there are cases where you may want to mutate a context, fetch objects and discard the changes (not propagate to the parent context, in a multi-context environment). Though, I must admit, I can't find a solution to the same problem we're having… still investigating, will follow up if we find an answer :) Nov 10, 2016 at 17:03
-
3Agreed it may not be practical in all scenarios, but it addresses OP's question.– stephentNov 10, 2016 at 17:26
-
2@MichaMazaheri I know this question is a bit old, but did you find a solution to this problem?– SAHMSep 12, 2018 at 18:10