Search code examples
swiftbuildcompiler-errorsxcode12xcode13

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


I am trying to create a build (Any iOS Device (arm64)), and I get an error:

/.../CoreData:1:1: API Misuse: Attempt to serialise store access on non-owning coordinator (PSC = 0x60000381b8e0, store PSC = 0x0)

The app compiles, and runs without any errors on all Simulators, and also on real devices (tested on 3 different iPhones). I have no logs in the console, only the error, not even a warning.

My app is not using Core Data. I'm only saving a couple of user settings within UserDefaults.

The setup: Xcode 13.1 (but the same thing happens on Xcode 12), Cocoapods, Swift 5, macOS Big Sur, SwiftUI 2.0 + Combine, I'm supporting targets from iOS 14+

What I've already tried:

  • I have reviewed the assets folders - no duplicate names, it's not empty.
  • I removed Lottie, and the file that it put within assets - didn't help.
  • I have updated all my pods.
  • I have tried cleaning Derived Data, clean builds, reinstalling pods, and restarting the Mac.
  • There is no Data(contentsOf:url) in my code.

Any idea why this could be happening?

This post doesn't help, I've tried all the suggested options. None of them apply here. This is actually using Core Data, so it doesn't apply, and neither do all the posts they mention, nor their suggestions in the comments.


Solution

  • 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.