Fetchedresultscontroller Swift 3 API Misuse: Attempt to Serialize Store Access on Non-Owning Coordinator

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

I have reviewed your all comments and contents posted here.
You have not shared one file here, but the problem is occurring you are creating invalid managed objects in the context.

And then whenever you call viewWillAppear() function in InventoryViewController, it saves the context.

Finally, it synced empty records into your database.
During parsing those invalid objects, it tried to parse nil value, so crashed.

Please never set default value for managed objects you are defining as properties.
I hope this will clarify your issue.

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

Problem seems to be solved.

It happened apparently, because the functions overwriteShoppingItems and fetchShoppingItems both setup a separate background context with let backgroundContext = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType) with their own queue so that fetches and saves were not serialized by a single queue.

I modified my code now in the following way:

I have now a property

let backgroundContext = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)  

that is initialized as

self.backgroundContext.persistentStoreCoordinator = self.persistentContainer.persistentStoreCoordinator
self.persistentContainer.viewContext.automaticallyMergesChangesFromParent = true

and fetches and saves are done using

backgroundContext.perform {…}  

Now the CoreData error is no longer logged, and no item is fetched as nil.

API Misuse: Attempt to serialize store access on non-owning coordinator - with Assets.xcassets

When I first read the question I didn't realize that this was a compiler error-- I thought it was happening when the app was running.

When the compiler has an error like this, indicating a crash, it's a bug in the compiler. Always. That should never happen. From your comments it sounds like your JSON file was triggering this bug. I don't know if it's something weird about that JSON file or if it's that Xcode doesn't like having JSON in an asset catalog. Either way though, it's an Xcode bug, because in the worst case Xcode should have told you to not put a JSON file there instead of doing this.

It's good to hear that you found a workaround. It's not something you can actually fix, but if your workaround does what you need then that's close enough. Apple could fix it though, so I recommend visiting https://feedbackassistant.apple.com and filing a bug about this.

Unable to create a Build due to CoreData: API Misuse when there's no Core Data in the App, and the app builds for all Simulators

Fixed the issue. What I did is:

  • removed two outdated pods (that were using Core Data) - this moved things on, but I stil had the same error.
  • Removed a file Lottie has added to Assets - this moved things forward, but didn't fix the situation.
  • removing and readding all the Assets - one by one - manually - this fixed the issue.


Related Topics



Leave a reply



Submit